The sample code below uses comma operator,
int inc(int i)
int main(int argc, char **argv)
a = b = c = 0;
while( ++a, a=inc(a), a < 3)
while( b=1, c=inc(c), c < 3)
++b, b=inc(b), ++b;
printf("%d %d %d\n", a,b,c);
I don't understand the condition(s) in the while-loop,
all the 3 conditions are to be satisfied (or) it is totally one condition
- If it is one condition then what is the return value of the condition? i.e., which statement's return value is it?.
- If it is 3 conditions then is ',' similar to '&&' ??
( ++a, a=inc(a), a<3 )
Please somebody tell me in short, How to use ',' operator?