#include<stdio.h>
main()
{
printf("Hi, ");
disp_msg();
printf(" Enjoy Learning ");
}
disp_msg()
{
printf("Welcome to C Programming,");
}
What will be the output?
-Hi, Enjoy Learning Welcome to C Programming,
No, the above generated output is not correct ,when you execute this ,you'll see :
-Hi, Welcome to C Programming, Enjoy Learning
because compiler executes the statements step-by-step ,so it goes the printf("Hi, "), then disp_msg(),
disp_msg() having some information which is in disp_msg(){...} block, so compiler executes it first ,
disp_msg()
{
printf("Welcome to C Programming,");
}
then printf(" Enjoy Learning "), so the output will be :
Hi, Welcome to C Programming, Enjoy Learning
main()
{
printf("Hi, ");
disp_msg();
printf(" Enjoy Learning ");
}
disp_msg()
{
printf("Welcome to C Programming,");
}
What will be the output?
-Hi, Enjoy Learning Welcome to C Programming,
No, the above generated output is not correct ,when you execute this ,you'll see :
-Hi, Welcome to C Programming, Enjoy Learning
because compiler executes the statements step-by-step ,so it goes the printf("Hi, "), then disp_msg(),
disp_msg() having some information which is in disp_msg(){...} block, so compiler executes it first ,
disp_msg()
{
printf("Welcome to C Programming,");
}
then printf(" Enjoy Learning "), so the output will be :
Hi, Welcome to C Programming, Enjoy Learning
No comments:
Post a Comment