Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming Quiz 106 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class Bix
{
public:
int x;
};
int main()
{
Bix *p = new Bix();

(*p).x = 10;
cout<< (*p).x << " " << p->x << " " ; p->x = 20;
cout<< (*p).x << " " << p->x ;

return 0;
}

[A].10 10 20 20
[B].Garbage garbage 20 20
[C].10 10 Garbage garbage
[D].Garbage garbage Garbage garbage

Answer: Option A