answersLogoWhite

0

Advantages:
Through Recursion one can Solve problems in easy way while
its iterative solution is very big and complex.
Ex : tower of Hanoi
You reduce size of the code when you use recursive call.

Disadvantages :
Recursive solution is always logical and it is very
difficult to trace.(debug and understand)

Before each recursive calls current values of the varibles
in the function is stored in the PCB, ie process control
block and this PCB is pushed in the OS Stack.
So sometimes alot of free memory is require for recursive
solutions.

Remember : whatever could be done through recursion could be
done through iterative way but reverse is not true.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Is macro a recursive function?

If you're asking if the c preprocessor supports recursive macros, the answer is no. The preprocessor is single-pass and since the "function" must be defined before it can be referenced, it can not be recursive.


What function that call themselves are called to c programme?

Functions in C language may call themselves (ie can be recursive) without restrictions.


What is self referential function in c plus plus?

A self-referential function in C++, or in any other supporting language, is a recursive function.


What r the Demerits of function in C?

Write a merits and demerits of using function in program


What is inline function in C Can you make inline function recursive or not If make can complier will compile that code?

The inline attribute is a C++ attribute, not a C attribute. Inline specifies that the function is to be expanded in place at the point of call instead of being called as a function. This means there will be one copy of the function for each call. This costs executable code, but can save execution time because the call setup and return time is avoided. Some functions cannot be inlined, and inline is really only a hint to the compiler. As far as recursive inlined functions, that depends on the implementation. The Microsoft implementation will not inline recursive functions unless they have a #pragma inline depth(n) line that specifies the maximum recusion depth the function will have. Consult your specific compiler documentation for the inline attribute for your specific implementation details.

Related Questions

What is the difference between function and recursive function?

I will explain in the easiest way the difference between the function and recursive function in C language. Simple Answer is argument of the function is differ but in the recursive function it is same:) Explanation: Function int function(int,int)// function declaration main() { int n; ...... ...... n=function(a,b); } int function(int c,int d) { ...... ...... ...... } recursive Function: int recursive(int,int)// recursive Function declaration main() { int n; ..... ..... ..... ..... n=recursive(a,b); } int recursive(int a,int b) { ..... .... .... .... } Carefully see, In the recursive Function the function arguments are same.


Can you use main function as a recursive function in C?

Yes


What is the definition of non recursive in c?

non recursive function is excuted faster than recrussive


Is macro a recursive function?

If you're asking if the c preprocessor supports recursive macros, the answer is no. The preprocessor is single-pass and since the "function" must be defined before it can be referenced, it can not be recursive.


Advantages of using C function?

* Debugging is easier * It is easier to understand the logic involved in the program * Testing is easier * Recursive call is possible * Irrelevant details in the user point of view are hidden in functions * Functions are helpful in generalizing the program


Biggest of three nos using recursive method?

biggest3 (a,b,c) = biggest2 (a, biggest2 (b,c))


What function that call themselves are called to c programme?

Functions in C language may call themselves (ie can be recursive) without restrictions.


Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


What is self referential function in c plus plus?

A self-referential function in C++, or in any other supporting language, is a recursive function.


Can you please answer me what are the advantages of recursion function using c?

The main advantage of recursive functions is that each call to the function maintains the state of the local variables from the previous call, which can then be re-used as the function calls begin to "unwind". However, function calls are expensive in terms of both performance and memory consumption, so it's important to recognise when recursion is required and when it is not. If the state prior to each call is not required when the call returns, iteration would be a far better option.


Can you implement the same using c?

Some function are not using in c


What r the Demerits of function in C?

Write a merits and demerits of using function in program