int main()
{
return 1;
}
1 is getting returned to whom in this case? As in if function x() is calling function y() and y() is returning something then x() gets it.So in above case who is catching 1 returned from main.
int main()
{
return 1;
}
1 is getting returned to whom in this case? As in if function x() is calling function y() and y() is returning something then x() gets it.So in above case who is catching 1 returned from main.
main
returns its value to some magic run-time start-up library code (that you didn't write and you generally can't see). But, depending on your OS, the value may make it out to your user environment. For example, on a Unix or Linux system, if I have five.c containing
int main()
{
return 5;
}
and if I do
cc five.c
a.out
echo $?
I'll see "5" as the exit status of a.out.