Head Recursion

void fun(int n) {
  if (n > 0) {
    fun(n - 1);
    printf("%d", n);
  }
}

fun(3);
// 1, 2, 3

A head Recursion is a recursive function where the first statement inside the function is a recursive call. All the processing is done after the recursive call. No statement, no operation before the function call.

The function doesn't have to process or perform an operation at the time of calling. It will do everything only at return time. It is not as easy to write as a loop as a tail recursion, it doesn't look as it is.

void fun(int n) {
  int i = 1;
  while(i <= n) {
    printf("%d", i);
    i++;
  }
}