r/C_Programming • • Jul 10 '26

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

64 comments sorted by

View all comments

Show parent comment

2

u/MagicalPizza21 Jul 10 '26

I believe all recursive algorithms can be rewritten to use a stack instead

Well, yeah. Arguably they already do; they use the program's stack. If the programmer makes it iterative in the way you describe, they just have to manage the stack themselves.

1

u/AndrewBorg1126 Jul 10 '26

And what's the rest of the same sentence?

... and even that such a representation can be trivially constructed with a compiler.