0
Why we are entering intmain() we can use voidmain()
5 Réponses
+ 5
Before down voting my answer you should check it your self. No, you cannot use void main it is not supported in new compilers.
if you use void main in new compiler like c++11 you will get error. It is depend upon you to go with c++ comunity or not. They did for us then why not use it. In later releases was to notify error occurred in program during execution to operating system on which it running. So, now this is standard that main function should be int type. Hope it help you
+ 1
If you use void means you don't have to add return statement in main function Now its compiler's duty to add flag that if program was successfull or not.
The return value is the exit code of your program, the shell (or any other application that ran it) can read and use it.
The 0 exit code (return 0) is a widely accepted convention for 'OK the program execution was successfull' , So it is good practice to use int main().
0
Because void main dosen't return data but int main does return data
0
yes you can
0
But if you use void main, you have to erase return 0;