Question
This program intends to access data through pointers. Please correct the errors in the program and fill in the blanks to complete the program. Submit
This program intends to access data through pointers.
Please correct the errors in the program and fill in the blanks to complete the program.
Submit the correct code and the running result.
The result should be (???? should be an address produced by your program):
------------------------
1 2 3 4 5 6 7 8 9 10 var = 5 Address of var = ????
pointVar = ???? Content of the address pointed to by pointVar = 5
_______________
Submit the correct code and the running result.
#include
using namespace std;
int main()
{
int testscores[10] = { 1,2,3,4,5,6,7,8,9,10 };
int* p = testscore;
for (int i = 0; i < 10; i++)
cout << (p++)<<" ";
cout << endl;
int var = 5;
int* pointVar;
pointVar = &var;
cout << "var = " << var << endl;
cout << "Address of var = " << (1)______________ << endl
<< endl;
cout << "pointVar = " << (2)_________ << endl;
cout << "Content of the address pointed to by pointVar = " << (3)____________________ << endl;
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started