/* */ #include #include int main (void) { int i = 3; printf("i = %i\n",i); printf("The memory address of i is %p\n",&i); /*note the use of %p to print the address */ /* declaration of pointer variables */ long *ptr; /*ptr is a variable that can contain addresses of long int variables */ long int j = 56; ptr = &j; /* assign the address of j to ptr */ printf("j = %i, its address is %p, ptr = %p\n",j,&j,ptr); /*dereferncing pointers */ printf("The value of the variable pointed to by ptr is %i\n",*ptr); /* initialising pointers */ int k = 97; int *ptr_to_k = &k; /* point ptr_to_k to the address of k */ printf("ptr_to_k has address %p dereferenced to %i\n",ptr_to_k,*ptr_to_k); }