Why a pointer + 1 add 4 actually

Because pointers are designed to be compatible with arrays:

*(pointer + offset)

is equivalent to

pointer[offset]

So pointer aritmetic doesn’t work in terms of bytes, but in terms of sizeof(pointer base type)-bytes sized blocks.

Leave a Comment