/* File: ptr_add.c Pointer addition is not what you think */ #include main(){ char c, *p1 ; int i, *p2 ; double f, *p3 ; p1 = &c ; p2 = &i ; p3 = &f ; printf("\nThe addresses of c, i and f are:\n") ; printf("p1 = %d, p2 = %d, p3 = %d\n", p1, p2, p3) ; p1 = p1 + 1 ; p2 = p2 + 1 ; p3 = p3 + 1 ; printf("\nThe new values of p1, p2 and p3 are:\n") ; printf("p1 = %d, p2 = %d, p3 = %d\n\n", p1, p2, p3) ; printf("Sizeof char = %d\n", sizeof(char) ) ; printf("Sizeof int = %d\n", sizeof(int) ) ; printf("Sizeof double = %d\n", sizeof(double) ) ; } ------------------------------------------------------ The addresses of c, i and f are: p1 = 2147469143, p2 = 2147469132, p3 = 2147469120 The new values of p1, p2 and p3 are: p1 = 2147469144, p2 = 2147469136, p3 = 2147469128 Sizeof char = 1 Sizeof int = 4 Sizeof double = 8