[A83] Re: C(++) programming


[Prev][Next][Index][Thread]

[A83] Re: C(++) programming





On Tue, 18 Sep 2001, Andreas Winkelbauer wrote:

> wrong, you can also have a main function like this: void main();
> then you won't find "return" in the main function.

You certainly can define the main function that way, but the C startup
code generally would expect an integer to be returned, so you should at
least get a warning when trying to compile that (GCC gives one).

Also, it is quite possible to use return in a void function; in this case
it simply exits the function at that point without giving a return value.

> you can never call main as far as i know! so a = main(); would be impossible
> because main is not a standard function.

It is non-standard in that it is the the main function called by the
startup code to run your program, but other than that, I don't know of
anything really unique about it.  Calling main from inside the program has
worked every time I tried it, though I don't think that it is useful to do
so very often.





Follow-Ups: References: