Thomas Hruska <[EMAIL PROTECTED]> wrote:
> kathir resh wrote:
> > hi friends,
> >    
> >   i want to know what does the return do with OS....

I presume you mean the return value from the original
call to main? [Or the parameter of exit().]

> > that is about successfully falgging
> 
> ...Usually used to detect an error condition.
> 'return 0' is used to indicate that 
> the program executed successfully,

True.

> anything else is an error condition.

Not necessarily. There is no C requirement that
EXIT_SUCCESS be 0, or that EXIT_FAILURE be non-
zero. There is no requirement that EXIT_SUCCESS
and EXIT_FAILURE have different values. Of course,
I've yet to see an implementation where that
wasn't the case.

Only 0, EXIT_SUCCESS and EXIT_FAILURE are truly
portable. Any other value will result in an
'undefined status' being returned to the host.

I think it's important to realise that the
language makes a distinction between the return
value of main and the 'status' returned to the
host. [Even Wintel machines provide an example
system the two are not the same. ;-]

-- 
Peter

Reply via email to