+ 3
Why should we use int main only why not void main
7 Antworten
+ 6
tl;dr - As of the latest standard in C++, main() must return int.
+ 4
A reason as to why you would wish to use void main() would be helpful for us to give you appropriate pieces of advice.
+ 2
This questiom has been asked a million times. Try searching on google on use the search bar on here 🌏
+ 1
u can use void but don't return anything
0
ohkie thanks and is this app good enough to understand full c++ rather than going to.a coaching
0
The main program that is running eventually should return an integer value, according to whether the program worked out without problems or not.
For example, when your program terminates itself without problem it finally returns "0".
See here for more detailed answer:
https://stackoverflow.com/questions/449851/why-do-we-need-to-use-int-main-and-not-void-main-in-c
0
the c++ standards needs int main() which means you can use any exit status.
while visual c++ is offering you void main() it has default exit status as 0