A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
The C standard defines two valid signatures for main: int main(void) and int main(int argc, char *argv[]). It also allows implementation-defined signatures. void main() is not standard. Some compilers accept it as an extension. Some reject it. The return type of main is int because the program must deliver an exit status to the parent process. void main() provides no mechanism for this. The program's exit status becomes undefined, implementation-specific, or always zero regardless of what happened.
#include <stdio.h>void main(void) {printf("Hello from void main\n");}
GCC warns but compiles. The program runs. The exit status happens to be 0 on this platform. But the standard does not guarantee this. On another compiler or OS, the exit status might be garbage. A script that checks $? after running this program cannot trust the result. The contract between the program and the shell is broken.
Old Turbo C textbooks. Embedded systems where no parent process reads the exit status. Misunderstandings carried forward by copy-paste. In embedded C, the startup code might call main as a void function and loop forever after it returns. In that specific context, void main is acceptable because the implementation defines it. For hosted environments (Linux, Windows, macOS), int main is the standard and the only portable choice.
int main is not a style preference. It is the standard. It is how your program communicates success or failure to the outside world. Use it. The two extra characters (in, t) are the cheapest portability insurance you will ever buy. Next: why gets() must never be used, and the secure alternative that replaced it.
Finish the lesson once you have worked through the material. This awards ★ 20 XP.