+ 3
Why can't we use void main () instead of int main ()
12 odpowiedzi
+ 8
Because there is a return type. From what I know the integer returned tells the status of the given operation, whether the main function executed alright or terminated abnormally.
+ 6
Void main is used when the main() function doesn't return anything. But in modern compilers void main() results in an error. It works in Turbo c++.
+ 5
Yes. Because of how C++ works.
+ 5
advanced compilers demands the return of a value...
after the execution of program
+ 3
In C you can.
https://code.sololearn.com/c4C3wI6Vw1f4/?ref=app
+ 2
So we can't use void main () for programs?
+ 2
Both are correct! 🤔
+ 1
merlynnoel25
Actually no, in other functions & classes except main() you can use void main()
+ 1
we can also use void main
but the difference between void main and int main is that
void main does not retrun anythings because it is void
and
int main will return a integer value
0
So basically with functions and classes everything, we only have to use int main () not void main () in c++ right??
0
Because operating system can understand only 0s and 1s only int contains 0 and 1 so we use int