20 Ott 2003Costruzione di Interfacce - Paolo Cignoni31 #include using namespace std; int main(int argc, char **argv) { int myInteger = 1000; int *myIntegerPointer = &myInteger; // declare another integer whose value is the same as the integer // at memory address int mySecondInteger = *myIntegerPointer; // print the value of the first integer before changing it cout << myInteger << endl; // dereference the pointer and add 5 to the integer it points to *myIntegerPointer += 5; // print the value of the integer after changing // it through the pointer cout << myInteger << endl; // print the value of the second integer cout << mySecondInteger << endl; }
{}