I have numbers;
A == 0x20000000
B == 18
C == (B/10)
D == 0x20000004 == (A + C)
A and D are in hex, but I'm not sure what the assumed numeric bases of the others are (although I'd assume base 10 since they don't explicitly state a base.
It may or may not be relevant but I'm dealing with memory addresses, A and D are pointers.
The part I'm failing to understand is how 18/10 gives me 0x4.
Edit: Code for clarity:
*address1 (pointer is to address: 0x20000000)
printf("Test1: %p\n", address1);
printf("Test2: %p\n", address1+(18/10));
printf("Test3: %p\n", address1+(21/10));
Output:
Test1: 0x20000000
Test2: 0x20000004
Test3: 0x20000008
address1
? Ifaddress1
is a pointer which points to something whose sizeof happens to be 4 bytes on your platform, thenaddress1 + 1
will calculate an address value offset from address1 by 4 bytes. (Note that int is often 4 bytes in size on a 32-bit desktop platform) – Ben Cottrell Sep 2 '12 at 20:07