What is indirect recursion? give an example?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
Can true be a variable name in c?
What is the process to generate random numbers in c programming language?
How do you convert strings to numbers in C?
why division operator not work in case of float constant?
name the language for writing c compiler?
Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and 100 to 1;
18 Answers Accenture, Cisco, Egentec, HCL, Ideaz, Infosys, M-Systems, MYR, TCS,
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
What are the uses of pre-processor directives?
Explain enumerated types in c language?
How to write a C program to determine the smallest among three nos using conditional operator?
main() { int i; printf("%d",scanf"%d",&i))//if the input is 12 24 34 then wat will be the output }
wite a programme in c to linear search a data using flag and without using flags?