// This program illustrates pointers (i.e. variables for memory addresses) // #include #include using namespace std; int main() { float *pt_x = 0; // Good practice to always initialize pointers to NULL float x = 3.14F; cout << "The value of x is " << x << "\n"; cout << "The address of x is " << &x << "\n\n"; pt_x = &x; cout << "The address of x is " << pt_x << "\n"; cout << "The value of x is " << *pt_x << "\n\n"; *pt_x = *pt_x + x + *pt_x; // Notice that *pt_x happens before the addition cout << "The value of x is " << *pt_x << "\n\n"; cout << "\n\n"; system( "PAUSE" ); return( EXIT_SUCCESS ); }