what's wrong with a>b?return(a):return(b);

What's wrong with the following expression?
Why does it throw an error?

 
  (a>b)?(return a):(return b);
return a is not an expression. a>b ? a : b is an expression.

Either if( a>b ) return a ; /* statement */ else return b ; /* statement */

Or return a>b ? a : b ;
Topic archived. No new replies allowed.