Sequence of Function Execution
Printf("%d%d",f1(),f2());
What is the sequence of function execution of the above statement.
1. printf, f1(), f2()
2. printf, f2(), f1()
3. f1(), f2(), printf
4. f2(), f1(), printf.
Questions by pn_5449 answers by pn_5449
Editorial / Best Answer
mohinuddinkhan
Let's understand this by going through the following code
#include<stdio.h>
int f1();
int f2();
void main()
{
printf("%dt%d",f1(),f2());
}
int f1()
{
printf("f1() enteredn");
return 4;
}
int f2()
{
printf("f2() enteredn");
return 5;
}
O/P-
f2() entered
f1() entered
4 5
we can conclude f2() is 1st executed
then f1() and in the end printf().hence we can say the precedence of execution of functions are from right to left.
Showing Answers 1 - 26 of 26 Answers
Sequence of Function Execution
What is the sequence of function execution of the above statement.
1. printf, f1(), f2()
2. printf, f2(), f1()
3. f1(), f2(), printf
4. f2(), f1(), printf.
Questions by pn_5449 answers by pn_5449
Editorial / Best Answer
mohinuddinkhanLet's understand this by going through the following code
#include<stdio.h>
int f1();
int f2();
void main()
{
printf("%dt%d",f1(),f2());
}
int f1()
{
printf("f1() enteredn");
return 4;
}
int f2()
{
printf("f2() enteredn");
return 5;
}
O/P-
f2() entered
f1() entered
4 5
we can conclude f2() is 1st executed
then f1() and in the end printf().hence we can say the precedence of execution of functions are from right to left.