0
In data types example why void main() is not there? Why int main()?
2 Answers
+ 3
The operating system that runs the program expects a return value from the program. 0 indicates that there was no error. That's why the last line of your code will usually be "return 0;". Every number which is not 0 indicates that there was some kind of error. In order to return a number, main() must be declared as int main(), not as void main() (void doesn't return anything).