+ 1
why int main is used in place of void main
2 Réponses
0
void main() is not supported by c++ and is no longer supported officially by c.
The idea is that a program will almost always want to return something to the environment it runs in, and if it is a void then nothing can be returned. Are there cases where this isn't a big deal? Sure. But forcing programmers to use int and returning 0 helps for things like compatibility and good habits.
0
thanks ryne got it close enough👍