Quote:
|
Originally Posted by TimCraig
i++ and its prefix version ++i only add one. There's no way to increment by a different value using this notation...
|
Here's something few people know about C: pointer arithmetic scales integers by the size of the type being pointed to. For example, if
ptr is a pointer to an
int, then
ptr++ will add
2 (or whatever the native size of an
int is for a particular target). If
parr is a pointer to a structure of twelve bytes,
parr = parr + 3 will add
36.
But don't abuse this fact. Pointer arithmetic is not necessarily something useful for programming PIC processors to control FRC robots.