Hi,
I made a function that should return 2 integers. But as the compiler
indicates in "return x,y", the x is ignored. So, it is even
possible what I want: returning 2 integers?
Thanks.
"return x,y;" is parsed as a return statement with an expression
"x,y". x and y are names of integer variables. The expression "x,y" is
two expressions "joined" by the comma operator. The comma operator
evaluates the first argument, has a sequence point, then the second
argument. The result of a comma operator is the evaluation of the
second expression.
Note that commas in function calls are not comma operators, and commas
in other contexts are not necessarily comma operators either.
Consider:
f(x, y); //not a comma operator
f((x, y)); //is a comma operator
x, y; //is a comma operator
return x, y; //is a comma operator
int x, y; //not a comma operator