/* Test passing the result (TestPassResultNew.cpp) */ #include using namespace std; int * squarePtr(int); int & squareRef(int); int main() { int number = 8; cout << number << endl; // 8 cout << *squarePtr(number) << endl; // 64 cout << squareRef(number) << endl; // 64 } int * squarePtr(int number) { int * dynamicAllocatedResult = new int(number * number); return dynamicAllocatedResult; } int & squareRef(int number) { int * dynamicAllocatedResult = new int(number * number); return *dynamicAllocatedResult; }