0
Can i use void main instead of int main???
in our school we are taught to use void main can anyone explain me the difference???
4 Answers
0
Void means something line "no return value", while int has to return integer. It is always bad to use void main(), because only some compilers support it, so it's possible you will get an error just because you use void main().
When you use int main(), it needs to return a value (return 0 means "program executed successfuly"). In some compilers return 0 is not necessarry, because they will add it to the end if you didn't do that.
So always use 'int main()' with 'return 0' statement in the end (in case your teacher allows you to do that :D)
0
yes u r right but int main didn't allow us to freeze the screen it is possible only with void main.isnt it?
0
It should be possible also with int. Try to use cin.get(), or if you use windows, use system("pause") (but your code will only work for windows).
0
yes I use win10 os