# Help me with recursion/recursive function!! PLZZZ!!!

This is a discussion on Help me with recursion/recursive function!! PLZZZ!!! within the C Programming forums, part of the General Programming Boards category; First of all please tell me the difference between recursion and recursive function plz... I m a new programmer.. and ...

1. ## Help me with recursion/recursive function!! PLZZZ!!!

First of all please tell me the difference between recursion and recursive function plz...

I m a new programmer.. and i want to learn recursion/recursive fun(in which function is called in a function)

can any one suggest me a good tutorial on the internet through which i can understand clearly and easily.. i m having my exam on Monday, and the only topic i dnt knw is this recursion... ...PLZ HELP!!!!!!!!

I will be grateful to you on your this act.........!!!!!!

2. Recursion is a type of algorithm - that is, you would use a recursive type of code, to solve the problem.

A recursive function is the function that actually uses recursion. Usually, this will be a single function however, sometimes you will have two functions that are mutually recursive: function A calls function B, which calls function A, etc. Relatively rare, but it happens.

Every recursive function has to have an end to the recursion. In a simple function you can still only have it call itself so many times (several hundreds to thousands, so it's a lot), but it has to have that stop in place.

This is a very simple recursive program. Find the stop, and change the value. Do you understand all of it? Remember that ++lo will increment lo BEFORE the parameter is passed to the next call.

Code:
```#include <stdio.h>

void printIt(int lo, int hi);

int main() { //
int limit=20;

printIt(0,limit);

printf("\n");
return 0;
}
void printIt(int lo, int hi) {
if(lo == hi)
return;
else {
printf("%2d  ",lo);
printIt(++lo, hi);
}
}```

3. Originally Posted by Adak
Recursion is a type of algorithm - that is, you would use a recursive type of code, to solve the problem.

A recursive function is the function that actually uses recursion. Usually, this will be a single function however, sometimes you will have two functions that are mutually recursive: function A calls function B, which calls function A, etc. Relatively rare, but it happens.

Every recursive function has to have an end to the recursion. In a simple function you can still only have it call itself so many times (several hundreds to thousands, so it's a lot), but it has to have that stop in place.

This is a very simple recursive program. Find the stop, and change the value. Do you understand all of it? Remember that ++lo will increment lo BEFORE the parameter is passed to the next call.

Code:
```#include <stdio.h>

void printIt(int lo, int hi);

int main() { //
int limit=20;

printIt(0,limit);

printf("\n");
return 0;
}
void printIt(int lo, int hi) {
if(lo == hi)
return;
else {
printf("-  ",lo);
printIt(++lo, hi);
}
}```
yeah i got this concept... but it is just a basic level....

these are the 2 questions. I atleast want to learn upto this extent...

4. Ok I looked at the link and almost rofl'd that you would ask for help on such a question good luck finding a tutorial on this and I mean that sincerely I don't think one exists personally maybe im wrong but also let me point you in a good direction:

Cprogramming.com: Get Expert Advice

5. Originally Posted by Cron
Ok I looked at the link and almost rofl'd that you would ask for help on such a question good luck finding a tutorial on this and I mean that sincerely I don't think one exists personally maybe im wrong but also let me point you in a good direction:
Well there's always.... THIS

(Enough to keep anyone busy for a couple of months)

6. Right on the assignment:

Make sure you submit your own work. Any form of collaboration will not be tolerated and case will be
forwarded directly to the Disciplinary Committee or in the best case, negative policy (Remember -100?).
This includes copying code snippets from the internet!

7. He says he's a beginner, and asks for basic info on recursion. After you give it to him, he says "No, I want help on using recursion for the Taylor Expansion series".

Quite the joker.

Popular pages Recent additions