Re: What will happen if main called in side main function?





Ravi wrote On 03/31/06 12:03,:
void main()
{
main();
}

This example is incorrect because main() returns an
`int'; it is not a `void' function. The C language does
not define what will happen when you mis-define main()
this way; however, on many implementations the effect
will be similar to the second example.

int main()
{
main();
}

This example will execute forever, provided the machine
running it has infinite resources. Less powerful machines
may be unable to run this program to completion ...

--
Eric.Sosman@xxxxxxx

.



Relevant Pages