doubt in basics in c | Sololearn: Learn to code for FREE!


doubt in basics in c

the purpose using return 0?

9/11/2020 3:15:06 PM


3 Answers

New Answer


Return 0 means the end of the executayion of a programme. It is used at the end of the programme to stop executing it


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.