+ 1

why int main is used in place of void main

20th Sep 2016, 5:31 AM
prijesh
prijesh - avatar
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.
20th Sep 2016, 5:52 AM
Ryne
Ryne - avatar
0
thanks ryne got it close enough👍
28th Sep 2016, 3:52 PM
prijesh
prijesh - avatar