(e-mail address removed) said:
<snip>
The reason why I asked this question is because I was not able to
undertand the following lines (mentioned in n1124.pdf at page 13.
"If the return type of the main function is a type compatible with
int, a return from the
initial call to the main function is equivalent to calling the exit
function with the value
returned by the main function as its argument;10) reaching the } that
terminates the
main function returns a value of 0. If the return type is not
compatible with int, the
termination status returned to the host environment is unspecified."
The wordings are really confusing. Whenever, I read these lines, I
endup in one or other kind of confusion.
Still, the meaning is unclear to me.
Fortunately, it doesn't matter, and you don't need to understand them. It's
great if you can, but it's not essential, provided you follow this
pattern:
1) always define main as either:
(a) int main(void)
or:
(b) int main(int argc, char **argv)
and:
2) always return either 0, EXIT_SUCCESS, or EXIT_FAILURE from main.
By the time those two simple rules let you down[1], you'll very likely be
an expert C programmer working on an embedded system, and you'll be able
to consult your system documentation to work out what to do.
[1] ...which they will never do, on conforming hosted implementations...