if statement - if(a,b,c,d) how does this work? -


this question has answer here:

int main(void) {   int a=0, b=20;   char x=1, y=10;   if(a,b,x,y)     printf("bye");   return 0; } 

how "if" condition in above code work work? value of "y" considered "if"?

yes, value of comma operator right operand. because none of other operands have side effects, boils down if (y).


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

c++ - Issues with OpenGL referencing when compiling in Ubuntu terminal -

Using Angularjs $http in browser console -