0

Why dont we put void main insted of int main

18th Oct 2018, 5:14 AM
Nimesh
4 ответов
+ 1
C/C++ use int main to return a value to the operating system when the program is finished, so it is clear if everything is ok (return 0;) or if something unexpected happed (for example return 1;). Other languages, however, don't use this anymore.
18th Oct 2018, 5:24 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
so why void main is used
18th Oct 2018, 5:25 AM
Nimesh
0
This is a problem of language design. C/C++ where designed to use int main (to give feedback to the OS) other languages (like java) have other ways to handle this and use void main instead.
18th Oct 2018, 5:29 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
why is getch(); used
18th Oct 2018, 5:38 AM
Nimesh