Interview Questions

Is using exit() the same as using return?

C Interview Questions and Answers


(Continued from previous question...)

Is using exit() the same as using return?

No. The exit() function is used to exit your program and return control to the operating system. The return statement is used to return from a function and return control to the calling function. If you issue a return from the main() function, you are essentially returning control to the calling function, which is the operating system. In this case, the return statement and exit() function are similar.

(Continued on next question...)

Other Interview Questions