Ask Question

What is the difference between recursion and iteration in C, and their advantages and disadvantages? ... ?

+2
Answers (1)
  1. 8 March, 10:36
    0
    I think both recursive and iteration are different programming approaches which have their own benefits and drawbacks.

    Recursive approach: In recursive approach the function calls itself until the condition is met. And it is slower than iteration, which means it uses more memory than iteration. recursion is like a selection structure, and which makes code smaller and clean. And a function partially defined by itself. Here tracing the code will be more difficult in the case large programs. Iterative approach: Iterative approach is a repetition process until the condition fails, here loops are used such as for, while etc. Here code may be longer but it is faster than recursive. And it consumes less memory compared to recursive approach. If the loop condition is always true in such cases it will be an infinite loop.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the difference between recursion and iteration in C, and their advantages and disadvantages? ... ? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers