Condition Statement MCQ 4 : Multiple conditions inside if statement

If - Else MCQ : Multiple Conditions Separated by Comma Operator

#include<stdio.h>
void main()
{
int a=1,b=2;
if(printf("%d",printf("123")),0)
  {
  printf("Connected");
  }
else
  {
  printf("Disconnected");
  }
}

Options :

  1. 123Connected
  2. 1233Connected
  3. 123Disconnected
  4. 1233Disconnected
[toggle title="Output"]1233Disconnected[/toggle]

Why ?

printf("%d",printf("123"))
  1. This is Example of nested Printf
  2. Inner printf will return number of Character Printed to Outer Printf so 1233 will be surly Printed.
  3. If statement will execute else part because if(1233,0). will results in if (0) - ” In Short Comma Operator Returns Rightmost Operand”so “Disconnected” will be printed