The function is recursive is a function that calls itself, always.
It's actually horrible, especially for memory handling and management.
RECURSIVE FUNCTION EXAMPLE
#include <stdio.h>
void movetorre (int n, char orig, char dest, char aux){
if (n==1) {printf("\nMover disco 1 da torre %c para a torre %c", orig, dest);
return;}
movetorre(n-1,orig,aux,dest);
printf("\nMover disco %d da torre %c para a torre %c", n, orig, dest);
movetorre(n-1,aux,dest,orig);
};
int main(){
int discos;
printf("\t\t\t\tTORRE DE HANOY\n\n");
printf("Digite a quantidade de discos: ");
scanf("%d",&discos);
movetorre(discos,'A','C','B');
return 0;
}
This is a simple example of an algorithm, with recursion, called the hanoi tower, made in c.
You can notice that she calls herself.
MUTUAL RESOURCES
Mutual recursion occurs when two or more functions are defined in terms of one another.
The most important basic example of a data type that can be defined by mutual recursion is a tree, which can be mutually defined recursively in terms of a forest (a list of trees).
TAIL RESOURCES
The recursive functions in the tail form a subclass of the recursive functions, in which the recursive call is the last instruction to execute.