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

diff. between *p and **p

3 Answers  


Explain which function in c can be used to append a string to another string?

0 Answers  


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

0 Answers  


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

0 Answers   HCL,


What is hungarian notation? Is it worthwhile?

0 Answers  






dynamically allocate memory for linear array of n integers,store some elements in it and find some of them

1 Answers  


how to exchnage bits in a byte b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3 please mail me the code if any one know to rajeshmb4u@gmail.com

3 Answers   Honeywell, Huawei,


How can you determine the size of an allocated portion of memory?

0 Answers   Aspire, Infogain,


Explain pointers in c programming?

0 Answers  


What is the difference between null pointer and void pointer

10 Answers   CTS, Manforce, MAQ Software,


Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.

2 Answers  


which one is better structure or union?(other than the space occupied )

2 Answers  


Categories