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 -

java - activate/deactivate sonar maven plugin by profile? -

tsql - Pivot with Temp Table (definition for column must include data type) -- SQL Server 2008 -