[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Help please!!
> I have a doubt with C.
> If the function main() returns a value with return x; - who gets this
> value? Is this return value stored somewhere?
> Also, who invokes function main()?
I don't think there is a platform agnostic answer. AFAIK, on posix
systems, the parent of your process can get the status returned by your
main(). All he has to do is use one of those "wait" calls and get the
status of your exit.
In a decent shell, this value is normally available as "$?", that
you can use to make decisions in shell scripts about the success/failure
of the program.