The new address pointed by a pointer, after a constant value is added to it, depends on the type it points to:
NewAddress = OldAddress + ConstantValue * sizeof ( Type )
So, in plain math, with pA += x
, you have
new_address_pointed_by_pA = old_address_pointed_by_pA + x * sizeof( int )
And since x=20
and an integer in your machine is 4 bytes big, this becomes
new_address_pointed_by_pA = old_address_pointed_by_pA + 20*4 =
= old_address_pointed_by_pA + 80
That's exactly what you experience, as 0x61FE68 - 0x61FE58
= 0x50. Your addresses, in fact, are represented in hexadecimal format. So the new address is 0x50=80
beyond the old one, and that fits with the simple calculation I showed above.
What does that new address contain? Well, we don't know. It depends on the history of that specific memory location.
If it was never used, it's not surprising it contained 0
. And it was also expected that after *pA = x
it contained 20. And, again, it is not surprising at all that the location it was originally pointing remains unchanged.
But... with that assignment you could have raised a segmentation fault exception. An OS usually raises this signal when a memory location not assigned to your task is accessed.
So, pay attention when you play with pointers, making sure that any arithmetics performed on them leads to legal new values.