int x, y; int *p1, *p2; /* Declare 2 pointers to int, */ /* p1 and p2 */ x = -42; y = 163; p1 = &x; /* p1 holds the address of x */ p2 = &y; /* p2 holds the address of y */ *p1 = 17; /* Put the value 17 into the */ /* container that p1 points to */ p1 = p2; /* Let the variable p1 now hold */ /* the same address as p2 holds */ p1 = &x; /* p1 holds the address of x */ *p1 = *p2; /* Put the value found at the */ /* address that p2 points to */ /* into the container that p1 */ /* points to. */
NULL is usually represented by 0 -- the address of the first byte in memory.
Since most C compilers do not put in code to check that your program is not trying to access the contents of the null pointer, you can generate tricky bugs by doing so.