What is indirect recursion? give an example?

Answers were Sorted based on User's Feedback



What is indirect recursion? give an example?..

Answer / hussain

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 ?    52 Yes 20 No

What is indirect recursion? give an example?..

Answer / vishwanath pillay

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 ?    29 Yes 7 No

What is indirect recursion? give an example?..

Answer / deepak verma

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 ?    5 Yes 4 No

What is indirect recursion? give an example?..

Answer / j j ramesh / ap / mca / jjcet

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 ?    10 Yes 11 No

Post New Answer

More C Interview Questions

What are the usage of pointer in c?

0 Answers  


explain what are pointers?

0 Answers  


write a programming in c to find the sum of all elements in an array through function.

0 Answers  


What does static mean in c?

1 Answers  


Is it better to use malloc() or calloc()?

0 Answers   Aspire, Infogain,






every function has return the value?

1 Answers  


what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.

6 Answers   HCL,


write a program to interchange the value between two variable without using loop

1 Answers  


Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)

1 Answers   HTC,


What is Your Name :)

1 Answers  


what is difference between ANSI structure and C99 Structure?

1 Answers   Wipro,


Write a program that takes a 5 digit number and calculates 2 power that number and prints it

7 Answers  


Categories