You are here:

C/exit() function

Advertisement


Question
We generally pass 0 or 1 values to exit() for success and failure respectively.
But I saw few programs where they are passing 2 , 3 or so...
like exit(2). what does this mean?


Answer
Hi Ravi

exit(0) generally means a clean exit without any error message

where as anything other than 0 means its exiting the program with an error message which can be handled by the operating system to warn the general user ... I believe you have often seen in windows that a program terminates and you get a message from the operating system with some error message and code though i haven't seen Turbo C to do something like that ever.

In case if you still have any doubt please feel free to ask me

regards
Joydeep Bhattacharya
http://www.scodz.com

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Joydeep Bhattacharya

Expertise

Ability to solve C and Data Structure problems and puzzles with simple and easy to understand logic.

Experience

C, C++, Java, Data Structure, PHP, Web Designing

Organizations
http://www.scodz.com Designation: webmaster

Publications
http://www.scodz.com

Education/Credentials
Master of Computer Applications

Past/Present Clients
http://analysingc.50webs.com http://www.funforu.com

©2012 About.com, a part of The New York Times Company. All rights reserved.