Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int i;
6.
char c;
7.
void *data;
8.
i = 2;
9.
c = 'd';
10.
data = &i;
11.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int i;
6.
char c;
7.
void *data;
8.
i = 2;
9.
c = 'd';
10.
data = &i;
11.
cout
Answer: Option B
Was this answer helpful ?
Because the data points to the address value of the variables only, So it is printing the memory
address of these two variable.
Output:
$ g++ poi2.cpp
$ a.out
the data points to the integer value0xbfc81824 the data now points to the character0xbfc8182f
Was this answer helpful ?
Submit Solution