+ 2
doubt in basics in c
the purpose using return 0?
3 Respostas
+ 7
Return 0 means the end of the executayion of a programme.
It is used at the end of the programme to stop executing it
+ 4
return from main() is equivalent to exit
the program terminates immediately execution with exit status set as the value passed to return or exit
return in an inner function (not main) will terminate immediately the execution of the specific function returning the given result to the calling function.
exit from anywhere on your code will terminate program execution immediately.
status 0 means the program succeeded.
status different from 0 means the program exited due to error or anomaly.
in main function return 0 or exit(0) are same but if you write exit(0) in different function then you program will exit from that position.
returning different values like return 1 or return -1 means that program is returning error .
When exit(0) is used to exit from program, destructors for locally scoped non-static objects are not called. But destructors are called if return 0 is used.