How is this number calculated?
Posted
by
Hamid
on Programmers
See other posts from Programmers
or by Hamid
Published on 2012-09-02T19:47:18Z
Indexed on
2012/09/02
21:48 UTC
Read the original article
Hit count: 330
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
© Programmers or respective owner