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.

Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends

Comments

Contact Us