I thin the addresses in an arrey is continuous then only the pointer arithmetics will work correctly. Correct me if i am wrong! | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
+ 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.

24th Oct 2019, 3:22 PM
George Alex
6 ответов
+ 1
what example are you talking about?
24th Oct 2019, 4:47 PM
Bahhaⵣ
+ 1
The Sample output given with the discription of pointer
25th Oct 2019, 3:28 AM
George Alex
+ 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
25th Oct 2019, 8:14 AM
Bahhaⵣ
+ 1
Yeah that's it
25th Oct 2019, 12:34 PM
George Alex
+ 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.
25th Oct 2019, 2:44 PM
Bahhaⵣ
+ 1
Yeah it's clear, thanks
25th Oct 2019, 4:54 PM
George Alex
Актуальное сегодня
Certificate