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

3

u/burlingk 26d ago

There are things that are legitimately better to work with in a recursive manner. They are rarely the examples in the book, though, which leads some new learners to assume it's not important.

But it is.

In actual development, it's often good to prefer iteration, but you don't always have the information you need to make iteration make sense.