Void main | SoloLearn: Learn to code for FREE!

0

Void main

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

c++

11/10/2016 1:20:08 PM

Anirudh Nair

5 Answers

New Answer

+5

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.

+2

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

+1

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

+1

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

-1

one is right and the other is void