GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 451 of 453    Print  
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.



  
Total Answers and Comments: 3 Last Update: October 30, 2009     Asked by: pn_5449 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Pradeep yoga
 
4. f2(), f1(), printf.

Above answer was rated as good by the following members:
tweeto, sandeep549, ramesh19
September 16, 2009 11:23:31   #1  
Pradeep yoga Member Since: September 2009   Contribution: 1    

RE: Sequence of Function Execution
4. f2() f1() printf.
 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 2Overall Rating: -N/A-    
September 19, 2009 03:58:15   #2  
aniket_tal Member Since: September 2009   Contribution: 1    

RE: Sequence of Function Execution
1. printf f1() f2()
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
October 30, 2009 05:55:28   #3  
mohinuddinkhan Member Since: October 2009   Contribution: 2    

RE: Sequence of Function Execution

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.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape