Write a C++ program to do the following:
#include <iostream> using namespace std; int main() { // Declare and assign values to int variables x, y int x = 5, y = 7; // Declare an int variable z; and store the sum of x and y in it int z = x + y; // Declare a pointer called pz and point it in the heap direction (using new) int *pz = new int; // Store the z value in the heap location using the pz pointer *pz = z; // Print the content of the pz pointer cout << *pz << endl; // Print the pointer (the address) cout << pz << endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.