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 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
Comments
http://www.a2zhacks.blogspot.com to learn C,C++,VB programming.