Sail E0 Webinar
Question


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
Options:
A .  2d
B .  two memory addresses
C .  both of the mentioned
D .  none of the mentioned
Answer: Option B

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 ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers