Void main | SoloLearn: Learn to code for FREE!


Void main

my school uses void main() instead of int main()...why so ?


11/10/2016 1:20:08 PM

Anirudh Nair

5 Answers

New Answer


int main returns an int value at the time of termination. Mostly applications designed through c++ have int as return type for main So that users may get relevant error codes. void main does not returns anything and programs terminate. Usually used while teaching(at my school too). But that does not changes coding even a bit.


both are same,a program starts execution from main function,as c++ requires to return int


int main() work in new version of c++


There is no such difference in those two Void main() tells your program to return void(nothing) to your operating system after completing the program execution where as int main() returns an integer value to your operating system after completing the execution of program


one is right and the other is void