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.
1 Answer
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. ;-)
-
Thank you so much for the explanation! Really appreciate it. Commented Jan 18, 2021 at 5:32