Posted On: Feb 22, 2018
Recursion: A function, which calls itself, recursion is simple to write in program but takes more memory space and time to execute.
Advantages of using recursion:-
Factorial program in c using Recursion
#include int factorial(unsigned int i) { if(i <= 1) { return 1; } return i * factorial(i - 1); } int main() { int i = 15; printf("Factorial of %d is %d\n", i, factorial(i)); return 0; }
Never Miss an Articles from us.
C defines another class of variables called static variables. Static variables are of two types:Static variables tha..
The scope resolution operator (::) is useful in C programming when both global and local variables have the same name,..
C language allows the use of the prefix register in primitive variable declarations. Such variables are called register..