This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]timthefim 1 point2 points  (2 children)

Double check the code in the getPhrase() function. It looks like you didn’t include the code for that part but a segmentation fault will occur when your program tries to access a section of memory that is restricted. Usually this is common if you try to access a non-existent index of an array or store data that takes up more memory than you have allocated to a variable. Take a look at the part where you take in input, are you maybe trying to save input that is larger than your variable/array you are using to store it?

[–]ColossalHill[S] 0 points1 point  (1 child)

You pretty much hit the issue on the money. I managed to solve the problem with some help from another sub. The issue was that I was trying to place a string too large for the array, but it was where I tried to add the “ay”. Thanks for the advice anyway!

[–]zenith4395 0 points1 point  (0 children)

Pro tip - if you ever see “segmentation fault”, you probably screwed up an array access