Why add a return statement for the main function in C important?


This question already has an answer here:

  • What should main() return in C and C++? 19 answers

Why is adding a return statement for the main() function in C important if the programs I make runs the same without it?

Is there a disadvantage in my programs if I omitted the return statement in the main() function?

It is by convention that you tell the operating system if your program exited successfully(returning 0), or if there was an error(for example, by returning an error code).

To remain more standards compliant, use return EXIT_SUCCESS or return EXIT_FAILURE.