+ 1
I thin the addresses in an arrey is continuous then only the pointer arithmetics will work correctly. Correct me if i am wrong!
The example shows different address. It doesn't make sense.
6 Respuestas
+ 1
what example are you talking about?
+ 1
The Sample output given with the discription of pointer
+ 1
are you talking about this output?
if not, could you paste the right one.
22 febd4760
33 febd4764
66 febd4770
55 febd476c
33 febd4764
+ 1
Yeah that's it
+ 1
alright,
we have an array of int type with 5 elements.
int a[5] = {22, 33, 44, 55, 66};
since its elements are integers they are 32bit in size or 4 bytes.
given that the first element 22 is in febd4760
the second element should be in febd4764
because febd4760 + 4 = febd4764
the next one add 4 to febd4764
febd4764 + 4 = febd4768
and so on.
we add 4 because that's the size of an integer (4bytes)
those numbers (adresses) are in base 16 hexadecimal.
hope it's clear now.
+ 1
Yeah it's clear, thanks