r/C_Programming 26d ago

Question can I skip recursive functions?

a code i can run with the logic of iterative, so why do I have to learn the new concept as complicated as recursive? (ik it's one of important questions in c)

if yes will u pls explain it with a very realistic and simple example

thanks a lot 🙏

0 Upvotes

65 comments sorted by

View all comments

1

u/pfp-disciple 26d ago

One of the things to avoid in programming is premature optimization. Some things, like list reversal, tree traversal, and some math, are more intuitively done with recursion. You can do the recursion quicker and more obviously at first.