What does this mean: that a pointer increment points to the address of the next base type of the pointer?
For example:
p1++; // p1 is a pointer to an int
Does this statement mean that the address pointed to by p1
should change to the address of the next int
or it should just be incremented by 2 (assuming an int
is 2 bytes), in which case the particular address may not contain an int
?
I mean, if p1
is, say, 0x442012, will p1++
be 0x442014 (which may be part of the address of a double) or will it point to the next int
which is in an address like 0x44201F?
Thanks
p1++
meansp1 += 1
, nothing else. – Centralization