+ 1

When we should use void main() and when to use int main()..!

I know that void returns nothing and int main returns atleast integer but when to use int and void..

24th Nov 2016, 2:35 PM
Tanu Purohit
Tanu Purohit - avatar
1 Answer
+ 1
There isn't a rule of thumb for the return type of main (). If your main function is called by another program and it needs to return an int value, then you should declare it as an integer. However, normally you will not need to do anything like this.
24th Nov 2016, 5:35 PM
Miltiadis Siavvas