// name: Pointers.cpp // desc: example showing some pointer operations // // to compile: // g++ -o Pointers Pointers.cpp #include using namespace std; // entry point int main( int argc, char ** argv ) { cerr << "foo" << endl; // a variable of type 'int' int n = 23; cerr << "n: " << n << endl; cerr << "&n: " << &n << endl; // a variable of type 'int *' int * pn = &n; cerr << "*pn: " << *pn << endl; cerr << "*&n: " << *&n << endl; cerr << "&pn: " << &pn << endl; // writing to what pn is pointing to *pn = 29; cerr << "*pn: " << *pn << endl; cerr << "n: " << n << endl; // a variable of type 'int **' int ** ppn = &pn; return 0; }