+ 2
Is it necessary to use return 0 in c++ programs?
3 Answers
+ 31
return 0 indicates to your main() that your program has run successfully without any errors.
You can use void main() if you don't want to write return 0
Also for int main() if you don't write return 0 it is understood by the compiler by default.
+ 2
Better use int main() and return 0 if your program exits normally. void main() does not conform to standard and compilers will give you warnings about this.
+ 1
no it's not necessary if u use void main in place of int main