#include int main(int argc, char* argv[]) { int i = 7; // variable i has a higher address than that of j, int j = -1; // for example, &i == 0x7ffffce2d96c // &j == 0x7ffffce2d968 int *pi = &i; int *pj = &j; printf(" i = %d\n", i); printf(" j = %d\n", j); printf(" pi= %p\n", pi); printf(" pj= %p\n", pj); printf(" data pointed to by pi= %d\n", *pi); printf(" data pointed to by pj= %d\n\n", *pj); *pi = 6; pi = pi - 1; // pi - 1 makes pi point to the address of pj // now the address pi and pj are the same, // so are the contents printf(" i = %d\n", i); printf(" j = %d\n", j); printf(" pi= %p\n", pi); printf(" pj= %p\n", pj); printf(" data pointed to by pi= %d\n", *pi); printf(" data pointed to by pj= %d\n\n", *pj); return 0; }