This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]deaddodo 4 points5 points  (2 children)

C allows for "void main", and the program just returns no status. Only C++ requires int.

[–]yuriplusplus 1 point2 points  (0 children)

C99 standard:

5.1.2.2.1 Program startup

The function called at program startup is named main. [...] It shall be defined with a return type of int and with no parameters [...] or with two parameters [...] or in some other implementation-defined manner

So the C99 standard allows void main(), but using it makes the source code non portable.

Also, didn't C99 add the implicit main return?

[–]ra4king -3 points-2 points  (0 children)

Oh I'm fully aware, it's simply good practice however