Hello,
I have been wondering for a long time about the return statement in the c-programming. Now consider the following code....
int main()
{
.............
return(0);
}
I would like to know where does the value zero(0) go???
Any function's return statement will return the value to it's calling function. Then what is it for main()???
have a gr8 day
bye tc
What happens to '0' in c program?
The return value of main() goes back to the operating system. Most of the time this value is just thrown away (99% of the time under windows).
It might be useful if for example, one program runs another program and wants to know if it was successful or not.
By convention, returning 0 means that your program executed successfully. What values other than 0 mean are really up to you, but odds are that you will never need to use it.
Hope that helped!
Reply:It's returned to the operation system.
When another process is running your program, it's able to get the return value and act accordingly.
morning glory
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment