C++ -- return x,y; The point?
- by Earlz
Hello, I have been programming in C and C++ for a few years and now I'm taking a college course in it and our book had a function like this
int foo(){
int x=0;
int y=20;
return x,y; //y is always returned
}
I have never seen such syntax. In fact, I never see the , operator used outside of parameter lists. If y is always returned though, then what is the point? Is there a case where a return statement would need to be created like this?
(Also, I tagged C as well because it applies to both, though my book specifically is C++)