C | Operators | Question 10

Last Updated :
Discuss
Comments
What is the output of following program? C
#include <stdio.h>

int main()
{
   int a = 1;
   int b = 1;
   int c = a || --b;
   int d = a-- && --b;
   printf("a = %d, b = %d, c = %d, d = %d", a, b, c, d);
   return 0;
}
a = 0, b = 1, c = 1, d = 0
a = 0, b = 0, c = 1, d = 0
a = 1, b = 1, c = 1, d = 1
a = 0, b = 0, c = 0, d = 0
Tags:
Share your thoughts in the comments