Can I use "goto statement" instead of Recursion in C/C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can I use "goto statement" instead of Recursion in C/C++?

I think the work of "goto" and a recursive function is almost same. So, is it possible to replace Recursion by Goto statement?

22nd Sep 2018, 5:46 AM
Surajit
Surajit - avatar
2 Answers
+ 2
the result is just about the same but it's several times slower and makes your code harder to read. so i don't recommend using it
22nd Sep 2018, 9:18 AM
hinanawi
hinanawi - avatar
- 1
You should avoid goto at all... It's not good style.
22nd Sep 2018, 9:09 AM
Matthias
Matthias - avatar