1

pointer incrementing

view story
linux-howto

http://www.linuxquestions.org – Looking for explanation as to why, using pointer arithmetic, pointer can be incremented as ptr +1, but cannot be incremented as ptr++, as in the following code: #include <stdio.h> int main(void){ int N = 7; int *ptr1; int array[] = {10, 20, 30, 40, 50, 60, 70}; //ptr1 = array; ptr1 = &array[0]; while(ptr1 < &array[N]){ printf("*ptr1 = %d\n", *ptr1); //this works fine ptr1 = ptr1 +1; printf("*ptr1 = %d\n", *ptr1); //this doesn't ptr1 = ptr1++; } return 0; } (HowTos)