I've got this program that just shows a little bit about pointer arithmetic. Using an array and a pointer, I just output the memory address of the first element using the pointer, then I incremented the pointer by 1 to output the next memory address, then I incremented the pointer by 1 again to output the next memory address. Then I used a second pointer and assigned it the memory address of the last element in my array. Then I outputted the memory address of that. I had to do a little digging in my book to try to understand the output. Here it is:
0012FF54
0012FF58
0012ff5C
0012ff60
I was using an integer array so the elements were 4 bytes. Going from the first element to the second, I understood the 4 moving to the 8, makes sense to me. Moving from the second element to the third, I did not understand the 8 moving to the C. But then I did a little reading on hexadecimal numbering and I think I understand why now. Hexadecimal has 16 digits, but when you get to 10 then you say A, 11 is B, 12 is C. So moving 4 bytes up from 8 would land you precisely on the letter C.
Then to understand moving from the third element to the last element you count again starting at C, D is one beyond that, E is two beyond that, F is three beyond that, and then finally back to 0 would land you at 4 bytes beyond that. So that's how I got it figured.
My question is moving from the 5 to the 6(in the third to the fourth element).
Is this just simply the way it works? It's just simply the way the consecutive elements would be numbered? And just accept it for what it is and not try to analyze it too much?