Hello, I have been programming in C and C++ for a few years and now I'm just now taking a college course in it and our book had a function like this for an example
int foo(){
int x=0;
int y=20;
return x,y; //y is always returned
}
I have never seen such syntax. In fact, I have never seen 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++)