I tried following example in C++ with visual studio.
void egg();
void chicken () 
{
    return egg ();
}
void egg () 
{
    return chicken ();
}
int _tmain(int argc, _TCHAR* argv[])
{
    chicken();
    return 0;
}
While running I got error like stackoverflow exception. Could any body please explain me why such error came. I was assuming this will go for infinite loop.
                        
Each time your
chicken ()callsegg()andegg()callschicken (), theirreturnaddress are pushed onto the stack. As the stack is finite memory, you are getting "error like stackoverflow exception".Read this for more understanding.