Can anyone tell me? What is the difference between exit(0) and exit(1) in C language?
Can anyone tell me? What is the difference between exit(0) and exit(1) in C
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What is the difference between
exit(0)andexit(1)in C language?exit(0)indicates successful program termination & it is fully portable, Whileexit(1)(usually) indicates unsucessful termination. However, it’s usage is non-portable.Note that the C standard defines
EXIT_SUCCESSandEXIT_FAILUREto return termination status from a C program.0andEXIT_SUCCESSare the values specified by the standard to indicate successful termination, however, onlyEXIT_FAILUREis the standard value for returning unsucessful termination.1is used for the same in many implementations though.Reference:
C99 Standard: 7.20.4.3 The
exitfunctionPara 5