// Chapter 3 - Program 1 #include main() { int *pointer_int;//declaring an integer pointer float *pointer_float;//declaring a float pointer int pig = 7, dog = 27; float x = 1.2345, y = 32.14; void *general;//a pointer to point--can be assigned any point. pointer_int = &pig;//assigns the address of pig to pointer_int. *pointer_int += dog;//adds the value of pig, (pointed to by *pointer_int), // to value of dog, and stores it in the address of pig, since it is pointed to //with *pointer_int. //next line uses cout to print the new value of pig cout << "Pig now has the value of " << *pointer_int << "\n"; general = pointer_int;//now general points to pointer_int //address), to general. pointer_float = &x;//assigns address of x to pointer_float y += 5 * (*pointer_float); //does calculation of amount stored in y to the value //of 5 times the value of x, since *pointer_float is pointing to x. cout << "y now has the value of " << y << "\n"; general = pointer_float;//now points to pointer_float! const char *name1 = "John"; // Value cannot be changed char *const name2 = "John"; // Pointer cannot be changed } // Result of execution // // Pig now has the value of 34 // y now has the value of 38.3125