Would this be ok?
Or is this wrong with int a, b, c, d;Code:if ( a, b, c, d == 1 || a, b, c, d == 2 || a, b, c, d == 3 || a, b, c, d == 4 || a, b, c, d == 5 ) {
Printable View
Would this be ok?
Or is this wrong with int a, b, c, d;Code:if ( a, b, c, d == 1 || a, b, c, d == 2 || a, b, c, d == 3 || a, b, c, d == 4 || a, b, c, d == 5 ) {
It's valid C, but it won't do what you expect. You would need to test each individual case...
The comma operator cannot be used in the way you describe.Code:if ( (a == 1 && b == 1 && c == 1 && d ==1) || (a == 2 && b == 2 && c == 2 && d == 2) ...
Thanks :D