Recursion is a technique where a function calls itself
until a base condition is reached.
It is useful for problems that can be broken into smaller sub-problems.
Why Use Recursion?
Cleaner and shorter code
Useful for trees and graphs
Ideal for divide-and-conquer algorithms
Solves repetitive problems easily
Factorial Example
#include <stdio.h>
int fact(int n){
if(n == 1) return 1;
return n * fact(n-1);
}
int main(){
printf("%d", fact(5));
}