see the subject! wich is more proper/better c++ style?
Printable View
see the subject! wich is more proper/better c++ style?
return 0;
It's all I've ever seen, anyway.
It helps readability to surround the return value with the (). It's not much if it's a constant (0, 1) but it does help when you're returning the value of a function or equation.
agreed
Either one works, it's a matter of personal preference since returning a simple value is easy to read anyway. Now, if you had something like
return i * j / c;
it wouldn't hurt to say
return ( i * j / c );
For simple return types such as 0 for a success and 1 for a failure I prefer to use the constants
return EXIT_SUCCESS;
and
return EXIT_FAILURE;
for added clarity.
-Prelude