Ask coding questions

← Back to all posts
how do u fix a stack overflow error?
AureyLia

Pretty much I just need help with figuring out how to fix the stack overflow error. I've never come across one before and I'm a bit confused...
thanks :)

Answered by Kai_Justice [earned 5 cycles]
View Answer
Voters
AureyLia
Comments
hotnewtop
Kai_Justice

The method DecideMeal calls itself on line 17, leading to an infinite loop and the stackoverflow error. You might be able to just replace line 17 with string meal = ""; and have it work. You might also want to set lines 30, 41, 52 to else if statements.

AureyLia

Thank you so much!

ch1ck3n

you should ask it on stack overflow

it usually happens when there's an infinite loop or a infinite recursion. it takes up like 100% of the computer's memory and it just commits die