ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2266)
 C++ interview questions  C++ Interview Questions (1121)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (651)
Question
What is indirect recursion? give an example?
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
void fun1()
{
static i=0;
if(i<5)
fun2();
}
void fun2()
{
printf("Recursion from fun2 to fun1 which is indirect
recursion\n");
fun1();
}
main()
{
fun1();
}
 
Is This Answer Correct ?    26 Yes 7 No
Hussain
 
Answer
# 2
void f1()
{
.....
if(condition)
{
f2();
....
}
}
void f2()
{
....
....
f1();
}

void main()
{
f1();
}


On closer look u'll find that the program goes lopping
itself again and again untill the condition in satified.
Once the cond. is met it will exit the loop and terminate
the prog.
But there is 1 important thing that:- the func's call is
indirect.
this is Indirect Recurssion.
 
Is This Answer Correct ?    18 Yes 4 No
Vishwanath Pillay
 
 
 
Answer
# 3
in c programing language in indirect recursion there are two function ,but when one function call to second and second call to first under condtion .when condition is false then the function is terminate. 
Is This Answer Correct ?    1 Yes 0 No
Deepak Verma
 
Answer
# 4
void fun1();
void fun2();
int i=0;

void main()
{
clrscr();
printf("\n\n\n");

fun1();

getch();
}

void fun2()
{
if(i<5)
{
printf("Recursion from fun2 to fun1 which is indirect
recursion\n");
i++;
fun1();
}
}
void fun1()
{
fun2();
}
 
Is This Answer Correct ?    3 Yes 5 No
J J Ramesh / Ap / Mca / Jjcet
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4   2
main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time. Cisco 1
biggest of two no's with out using if condition statement   5
how the compiler treats any volatile variable?Explain with example. Tata-Elxsi 1
Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.   6
Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..   2
Write a program in c to print 1 121 12321 1234321 123454321 Wipro 6
c program to subtract between two numbers without using '-' sign and subtract function.   1
program for swapping two strings by using pointers in c language   1
what is mallloc()?how it works? Excel 4
If the static variable is declared as global, will it be same as extern? Samsung 1
what is the difference between i++ and ++i?   5
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com