r/C_Programming • u/yug_jain29 • 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
View all comments
Show parent comment
1
u/Computerist1969 Jul 10 '26
A recursive function uses the stack. Recursive functions are a common cause of stack overflows. The CPU does not translate it into an iterative form, it recurses. The machine code syntax looks different but it's going to store variables to be used as input to the next round, and perform a jsr back to itself and so on. Recursion. It's not C that gives you a stack overflow it's the computer.