0

Void main

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

10th Nov 2016, 1:20 PM
Anirudh Nair
Anirudh Nair - avatar
5 Respuestas
+ 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.
10th Nov 2016, 1:58 PM
Megatron
Megatron - avatar
+ 2
both are same,a program starts execution from main function,as c++ requires to return int
10th Nov 2016, 1:30 PM
Krishna Teja
Krishna Teja - avatar
+ 1
int main() work in new version of c++
10th Nov 2016, 3:26 PM
Mohammadreza Mzfn
Mohammadreza Mzfn - avatar
+ 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
11th Feb 2017, 5:57 PM
Bharath yadav
Bharath yadav - avatar
- 1
one is right and the other is void
10th Nov 2016, 5:11 PM
Daniel Rollins
Daniel Rollins - avatar