Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int *p;
6.
void *vp;
7.
if (vp == p);
8.
cout
Options:
A .  equal
B .  no output
C .  compile error
D .  runtime error
Answer: Option A

The void pointer is easily converted to any other type of pointer, so these are equal.
Output:
$ g++ poi4.cpp
$ a.out
equal



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers