The difference between return and exit()?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > The difference between return and exit()?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    The difference between return and exit()?  
learning_C++


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-28-04 08:32 AM

Hi,
I often see the functions like exit() and close(). Can they replace
return in the c program? Which header includes them?
What is the difference between exit(0), exit(1) and exit(...)?
Please give me some examples.

Thanks,





[ Post a follow-up to this message ]



    Re: The difference between return and exit()?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-28-04 08:32 AM

learning_c@hotmail.com (learning_C++) writes:

> Hi,
> I often see the functions like exit() and close(). Can they replace
> return in the c program? Which header includes them?
> What is the difference between exit(0), exit(1) and exit(...)?
> Please give me some examples.

exit() causes the program to exit with the argument as return value.
The return statement only returns from a function to its caller.  In
main(), this amounts to exiting the program.  close() is for closing
files opened with open().

Use the command "man" to view the manual for these function.  Running
"man exit" will give information on the exit() function, etc.

--
Måns Rullgård
mru@mru.ath.cx





[ Post a follow-up to this message ]



    Re: The difference between return and exit()?  
Alex Vinokur


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-28-04 01:28 PM


"learning_C++" <learning_c@hotmail.com> wrote in message news:44bd0859.0409280026.16dfcd53@p
osting.google.com...
> Hi,
> I often see the functions like exit() and close(). Can they replace
> return in the c program? Which header includes them?
> What is the difference between exit(0), exit(1) and exit(...)?
> Please give me some examples.
>
> Thanks,

The difference between return, exit() and abort() in C++ program can be seen
 at
http://groups.google.com/groups?sel...p1.dejanews.com

--
Alex Vinokur
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:05 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register