Parenthesis surrounding return values in C

There really isn’t a reason…it’s just old convention.

To save space, programmers would often do the final math in the return line instead of on it’s own line and the parens ensure are mostly there to make it easier to see that it is a single statement that is returned, like this:

return (x+i*2);

instead of

int y = x+i*2;
return y;

The parenthesis became a habit and it stuck.

Leave a Comment