/* Example: increment pointer value in C language */ #include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { int i = 6; int*ptr ; *ptr = i; (*ptr)++; // increment the value of(*ptr),that is the value of i printf("%d\n",*ptr); printf("%d\n",ptr); *ptr++; // The value of ptr address is incremented 。 * has priority over ++ printf("%d\n",ptr); printf("%d\n",*ptr); // the value of new address, it's not initialized, so it is 0. return 0; }Source:.wwwlautturi.com
example of output:
7 46423984 46423988 0
|--------|--------\ |42000004|7 | |--------|--------| | .... | |--------|--------| |46423984|42000004| |--------|--------| |46423988|0 | |--------|--------|