Pointer incrementation and assignment
Henry Spencer
henry at utzoo.uucp
Sat May 27 02:48:21 AEST 1989
"a++", "a += 1", and "a = a + 1" are all precisely synonymous, by definition,
excluding obscure side effects. When "a" is a pointer, all three increment
it to point to the next object of the type it points to. This typically
means adding sizeof(*a) to "a", treating it as if it were an integer. Note
the word "typically" in that sentence -- it doesn't have to work that way.
Note also that there may not *be* a "next object" unless "a" and "a+1" both
point into the same array (or one past its end).
--
Van Allen, adj: pertaining to | Henry Spencer at U of Toronto Zoology
deadly hazards to spaceflight. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list