> A pointer contains only an address. It does not contain the size of the pointed-to object.
The compiler does sizeof(*ptr) for you.
ptr++ always ends up pointing to the next object of the type being pointed to.
> A pointer contains only an address. It does not contain the size of the pointed-to object.
The compiler does sizeof(*ptr) for you.
ptr++ always ends up pointing to the next object of the type being pointed to.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.