Re: What will happen if main called in side main function?
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 19:50:23 +0100
Eric Sosman wrote:
Ravi wrote On 03/31/06 12:03,:
<snip>
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 ...
A slightly better implementation without infinite resources might use tail recursion optimisation and convert it in to a simple loop that only terminates when the machine itself is terminated.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
.
- References:
- What will happen if main called in side main function?
- From: Ravi
- Re: What will happen if main called in side main function?
- From: Eric Sosman
- What will happen if main called in side main function?
- Prev by Date: Re: More on pointers to pointers.
- Next by Date: Re: How to define an array of struct nested within a struct?
- Previous by thread: Re: What will happen if main called in side main function?
- Next by thread: Re: What will happen if main called in side main function?
- Index(es):