#include // Declare some global integers: int i = 5; int j = 6; int sum; int main () { // Int pointer declarations: int *intPtr; int *intPtr2; int *intPtr3; // First, let's print the address of variable i: printf ("Variable i is located at address %p\n", &i); // Now extract the address of variable i into the pointer: intPtr = & i; // Print. printf ("The int at memory location %p is %d\n", intPtr, *intPtr); // Let's do some arithmetic. intPtr2 = & j; sum = (*intPtr) + (*intPtr2); printf ("The sum of %d and %d is %d\n", *intPtr, *intPtr2, sum); // Now for something stranger: printf ("The integer at location %p is %d\n", (intPtr+1), *(intPtr+1)); printf ("The integer j=%d is at location %p\n", j, &j); // Let's see what the default initial value of intPtr3 is: if (intPtr3 == NULL) { printf ("intPtr3 has been initialized to NULL\n"); } else { printf ("intPtr3 has been initialized to %p\n", intPtr3); } }