Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int n = 5;
6.
void *p = &n;
7.
int *pi = static_cast(p);
8.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int n = 5;
6.
void *p = &n;
7.
int *pi = static_cast(p);
8.
cout
Answer: Option A
Was this answer helpful ?
We just casted this from void to int, so it prints 5
Output:
$ g++ poi1.cpp
$ a.out
5
Was this answer helpful ?
Submit Solution