What is output of the given code? void main ()
What is output of the given code?
void main ()
{
int a = 3, b, *p, **q;
p = & a;
q = & p;
b = 2 * (**q + *p);
cout << b;
}
Show answerHide answer
Correct answer: (B) 12
Explanation
p points to a and q points to p, so **q = 3 and *p = 3. b = 2 × (3 + 3) = 12.