/* File: pointers.c A simple program that uses pointers. */ #include #include "genlib.h" #include "simpio.h" main () { int a = 1, b = 2, c = 3 ; /* These are pointer declarations */ int *ptr1, *ptr2 ; ptr1 = &a ; printf("a = %d, &a = %d, ptr1 = %d, *ptr1 = %d\n", a, &a, ptr1, *ptr1) ; ptr1 = &b ; printf("b = %d, &b = %d, ptr1 = %d, *ptr1 = %d\n", b, &b, ptr1, *ptr1) ; *ptr1 = 35 ; printf("b = %d, &b = %d, ptr1 = %d, *ptr1 = %d\n", b, &b, ptr1, *ptr1) ; ptr2 = ptr1 ; *ptr2 = 17 ; printf("b = %d, &b = %d, ptr1 = %d, *ptr1 = %d\n", b, &b, ptr1, *ptr1) ; } ------------------------------------------------------ a = 1, &a = 2147469132, ptr1 = 2147469132, *ptr1 = 1 b = 2, &b = 2147469128, ptr1 = 2147469128, *ptr1 = 2 b = 35, &b = 2147469128, ptr1 = 2147469128, *ptr1 = 35 b = 17, &b = 2147469128, ptr1 = 2147469128, *ptr1 = 17