web analytics

What is recursion?




Recursion : Recursion is a special case where a function calls itself. A very simple example of recursion is presented below,





main(){
printf(“This is an example of recursion.n”);
main();
}


When executed this program will produce an output which is something like this,

This is an example of recursion.
This is an example of recursion.
This is an example of recursion.



Execution is terminated abruptly; otherwise the execution will continue indefinitely.
Thank you. Take a moment to share 🙏