0

In data types example why void main() is not there? Why int main()?

26th Jan 2019, 7:40 AM
hetvi Ashokbhai parikh
1 Antwort
+ 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).
26th Jan 2019, 8:39 AM
Anna
Anna - avatar