0

I've been trying to break it down into parts but I can't figure out why I keep having a segmentation fault. I've watched the lecture but I can't figure out where to put the breakpoint to find it. Im almost certain it has something to do with the first if statement as it doesn't prompt the user. Any help would be very much appreciated. enter image description here

1
  • 2
    You should post your code as text using the code button on the editor and not as an image. This will make it easier for people to test as they can copy it into their IDEs to isolate and confirm the issue (plus read it easier). Commented Jan 18, 2021 at 1:16

1 Answer 1

2

The seg fault is here:

isalpha{argv[1])

The isalpha function and all of its cousins take a single char as input. argv[1] is a string, not a single char. When you try to ram a string down it's throat, it chokes and throws an error.

As for seg fault diagnosis, you may find this useful:

Do YOU know how to find a seg fault?? Advice to new programmers

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • Thank you so much for the explanation! Really appreciate it.
    – frostyf33t
    Commented Jan 18, 2021 at 5:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .