I want to know when it is necessary to include a return statemnt in one's code and also what is the difference between recursion and iteration?
IwalkAlone 7
Light Poster
Recommended Answers
Jump to Post>when it is necessary to include a return statemnt in one's code
When you're returning from any function whose return type is not void.>what is the difference between recursion and iteration?
At what level? At the highest level, there's no difference. Go a bit lower and recursion is …
Jump to Post>>you can call the function at any point of the program
that may, or may not be recursion. recursion happens only when the function is called somewhere within the same function. For examplevoid foo() { <snip> foo(); }
Jump to Post>So can you say that the point I made is the difference between them?
No. I don't see how the two statements describe a difference unless you're adding the restriction that only one loop can be used ever and it can't be placed in a function.
All 10 Replies
Narue 5,707
Bad Cop Team Colleague
IwalkAlone 7
Light Poster
Ancient Dragon 5,243
Achieved Level 70 Team Colleague Featured Poster
Narue 5,707
Bad Cop Team Colleague
IwalkAlone 7
Light Poster
Narue 5,707
Bad Cop Team Colleague
IwalkAlone 7
Light Poster
IwalkAlone 7
Light Poster
Narue 5,707
Bad Cop Team Colleague
IwalkAlone 7
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.