In C, When a function calls a copy of itself then the process is known as Recursion. To put it short, when a function calls itself then this technique is known as Recursion. And the function is known as a recursive function.
You have to be more careful when you are using recursion in your program. You just cannot use recursion in all your problems because it will make your program more complex and difficult.
Recursion can be used in case of similar subtasks like sorting, searching, and traversal problems. While using recursion, you will have to define an exit condition on that function, if not then it will go into an infinite loop.
void do_recursion()
{
... .. ...
do_recursion();
... .. ...
}
int main()
{
... .. ...
do_recursion();
... .. ...
}
#include<stdio.h>
int main()
{
printf("TechVidvan Tutorial: Infinite loop through Recursive Function!\n");
main();
return 0;
}