Write C++ code that creates an integer variable called number. Dereference a giv
ID: 3751291 • Letter: W
Question
Write C++ code that creates an integer variable called number. Dereference a given pointer gPointer and places that value into the variable number. The pointer gPointer will have been declared and set to point to a value before your code runs. Your code will be placed inside the main function with all the appropriate #includes. After your code runs, the test case will execute the following code: cout << "number = " << number << endl; For example: Test Result int x = 9; int *gPointer = &x; number = 9 int x = 834; int *gPointer = &x; number = 834
Write C++ code that creates an integer variable called number. Dereference a given pointer gPointer and places that value into the variable number. The pointer gPointer will have been declared and set to point to a value before your code runs Your code will be placed inside the main function with all the appropriate#includes. After your code runs, the test case will execute the following code: coutExplanation / Answer
/*If you have any query do comment in the comment section else like the solution*/
#include<iostream>
using namespace std;
int main()
{
int x=8;
int *gPointer=&x;
int number=(*gPointer);
cout<<"number = "<<number<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.