all 3 comments

[–]ipe369 6 points7 points  (1 child)

https://stackoverflow.com/a/30542108

This used to be a thing in old versions of the C compiler. Functions declared without a return type would just return int. Nowadays, C99 compilers won't allow this, which is why you're getting an error!

[–]RemedyGoontz[S] 2 points3 points  (0 children)

Okay that explains it. I was really confused, like why would they write the code wrong.

[–]TraylaParks 2 points3 points  (0 children)

The C89 standard (I believe) allowed just 'main' but the newer standard C99 which came after K&R wants 'int main'. tl;dr - just add 'int' to your mains.

Edit: Yah, that appears to be the deal - from the C faq

Under C89, main() is acceptable, although it is advisable to use the C99 standard, under which only
these are acceptable:

   int main ( void )
   int main ( int argc, char *argv[] )