+ 1

what is theDifference between void main() and int main() ?

By using both the statement the program works. The difference between them are that we have to return a value in int main() . But what does they impact on the program ?

24th Sep 2016, 2:15 PM
Rishabh Jain
Rishabh Jain - avatar
3 Respuestas
+ 5
There is no impact on the program itself. But the operating system, that calls your application, might want to know if your application ran correct or if there was an error. So to signal this, you return a error / status code which can then be evaluated by the OS/caller of your program.
24th Sep 2016, 3:12 PM
René Schindhelm
René Schindhelm - avatar
+ 1
how not to program in c++ by Steve Qualline i read on this book that the standard way is int main and the other one is wrong.
24th Sep 2016, 5:31 PM
Zaman
Zaman - avatar
+ 1
void main() return nothing to OS and Int main() returns int value to OS
19th Apr 2017, 3:17 PM
Hardik Gupta
Hardik Gupta - avatar