I checked the style guide https://manual.cs50.net/style/

and the C99 Standard https://en.wikipedia.org/wiki/C99

And neither explicitly states the best format but both implicitly write out main as so

int main(void) 

Without the space between the function name and the parentheses.

However conditionals and loops all have a space and I have got into the habit of putting a a space between the main and the parentheses like so:

int main (void)

The compiler parses this fine, however I want to know is it going to hurt me on certain edge cases, should I work on altering this habit and correcting this space?

This is a minor detail question but it has been bugging me.

1 Answer 1


Nope, won't hurt a thing. It's just a matter of style, but has no effect on functionality.

The common practice though is not to have a space between main and the first parenthesis.

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

  • Or more generally between a function's name and its following parentheses around its parameters for that matter.
    – ChrisG
    Oct 2, 2015 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .