
Recursions
Recursions seem to be a very very very confusing subject I know it is for me so I was wondering if someone was kind enough to give me an example of recursions, I mean the easiest one you can come up with, because for the time being I need the easiest example possible.

here
int example(int n){
if (n==1) //must have base case to get out of recursion
return (1); // base case, when n = 1, return value 1
answer = example (n1) * 2; //recursively decrement n, *2
//when n = 1 it'll get out
return (answer);
}
//non recursion of the same program
int example2 (int n){
int t, answer;
answer = 1;
for (t=1; t<= n; t++)
answer = answer*t;
return (answer);
}
//you can write every recursion NONrecursively, many times recursion is too much over head. But Easier to understanding.
cycbersnaek

Code:
#include <iostream>
using namespace std;
void print(char *a)
{
if(a[0]!=0)
{
cout << a[0];
print(++a);
}
}
int main()
{
char rec[]="Recursion";
print(rec);
return 0;
}

Thank you
Thanks guys I believe I got it with your help