Consider the following code which shows compile time error :
#include <stdio.h>
int main(int argc, char** argv)
{
int x=5,y=0,z=2;
int a=z?x,y?x:(y); // but z?x,y?x:y:z is not showing any error
printf("%d",a);
return 0;
}
Please help me explain the reason why z?x,y?x:y:z is not showing any error?
Why would it; it’s valid and groups like this:
The middle operand of the conditional expression can be any expression.