The base case is the condition that specifies when the recursive function should stop calling itself. It defines the simplest case where the solution can be directly calculated without any further recursion.
Example: Finding the sum of natural numbers using recursion
#include <stdio.h>
int sum(int n) {
if (n == 0)
return 0;
else
return n + sum(n - 1);
}
int main() {
int num = 5;
int result = sum(num);
printf("Sum of natural numbers up to %d is %d\n", num, result);
return 0;
}