Question

Possible Duplicate:
What does the ',' operator do in C?

Ok I had an interview today and they asked me what should be the output of the following code

#include<stdio.h>

int main ()
{

int a=1,b=1;
char c='0';
if(a,b,c)
   printf("wow \n");
}

after running it on my machine I am able to get the answer but I was not able to answer there.I want to know if such a if statement is allowed? Where is it mentioned?

My problem is the if condition mentioned above I am not able to understand how does that if statement work.

**UPDATE **
I did not found any such thing in K&R can any one recommend a good book.I have programmed things and not new to C but still after failing this question I want to once more look if some more C concepts in depth (specially such as above) are mentioned where can I read.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top