0
what is the difference between return 0; and return 10000000; ? the code runs in the same way though any of these is applied.
2 Answers
+ 9
In main, return 10000000 and return 0 won't matter to us, but they will to the program.
You see, return in main is used to return an exit code that is used by the compiler to determine whether the execution in the end was successful or not. Errors , like SIGSEGV, SIGABRT, etc, are identified by special numbers, like 255, etc. When 255 is returned, the compiler is notified that a SIGSEGV error had occurred.
Thus, according to the standard, one should use 0 as 0 has been preset to be the return code for successful termination of a program.
+ 1
Itâs no different
Is just a code word that the computer will use to say(âHey We did it and here is the code word you told us to say if we did it correctlyâ)