Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x;
6.
int *p;
7.
x = 5;
8.
p = &x;
9.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x;
6.
int *p;
7.
x = 5;
8.
p = &x;
9.
cout
Answer: Option A
Was this answer helpful ?
In this program, we are copying the memory location of x into p and then printing the value in
the address.
Output:
$ g++ def1.cpp
$ a.out
5
Was this answer helpful ?
Submit Solution