Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Predict the output of the following Functions.

Predict the output of the following Code Snippets.
This is an exercise based on Functions.
The answers are provided at the bottom of the exercise. Be honest with yourself. :P

//1
main()
{

printf("\nOnly stupids use c?");
display();
}

display()
{
printf("\nFools too use C!");
main();

}





//2
main()
{
printf("\nC to it that C survives.");

main();
}





//3
main()

{
int i=45, c;
c=check(i);

printf("\n%d", c);
}
check (int ch)

{
if (ch>=45)
return (100);

else
return (10*10);
}





//4
main()
{
int i=45, c;

c=check(i*1000);
printf("\n%d", c);

}
check (int ch)
{
if (ch>=40000)

return (ch/10);
else
return (10);

}




//1) infinite loop of both the statements

//2)The message " C to it that C survives" is iterated infinitesimally!

//3) 100

//4) 4500











The file can be downloaded at:
Download File



This post first appeared on Learning To Program, please read the originial post: here

Share the post

Predict the output of the following Functions.

×

Subscribe to Learning To Program

Get updates delivered right to your inbox!

Thank you for your subscription

×