Error in ternary expression

Posted by Bipul on Stack Overflow See other posts from Stack Overflow or by Bipul
Published on 2010-03-15T06:37:15Z Indexed on 2010/03/15 6:39 UTC
Read the original article Hit count: 312

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c

    Related posts about expression