i have to use exit(1) command in a function.
Does it have anything to do with the return data type of the function in which it is being used?
i have to use exit(1) command in a function. Does it have anything to
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.
No. The
exitfunction never returns but instead terminates the process it’s called from. The C compiler has no intuitive understanding of it and treats it like any othervoidreturning function.This does mean though that while
exitwill end your function the C compiler doesn’t see it that way. Hence it will still want a valid return else it will spit out warnings /errors (with a high enough error level enabled). But this is easy enough to work around