+ 10
[DUPLICATE] Why int main() {} instead of void main() {}?
Why does the main function have to return a value?
2 Answers
+ 10
Yes, its int main() because it returns 0.
#include <iostream>
using namespace std;
int main() {
return 0; //Here
}
+ 9
Yeah, main() has to return a zero to the operating system so that your operating system knows it finished successfully as per the C++ specification.



