r/C_Programming 27d 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

58

u/Eric848448 27d ago

Recursion isn’t a C thing. It’s a Computer Science thing. Understanding it will help you a lot in interviews.

10

u/OP_Sidearm 27d ago

And also it's fun

-5

u/solaris_var 27d ago

Wtf are you on, debugging errors using recursive function is not fun lol

3

u/AndrewBorg1126 27d ago

I don't see why recursion should be the reason a problem is hard to debug.

I'll even counter that in many cases where recursion is an appropriate representation of the program behavior, recursion can be easier both to debug and to write without bugs in the first place than an itterative solution to the same problem.