undefined

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Recursion - Part I

So far, we have seen examples of main calling other functions. It's possible for any function to call another; for example:

#include<iostream>
using namespace std;
void bar() {
cout << "bar" << endl;
}
void foo() {
cout << "foo" << ' ';
bar();
}
int main() {
// enter foo and print "foo", then enter bar and print "bar"
foo();
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content