After starting caesar with an additional argument and providing the sentence that needs to be encrypted, the Terminal shows this response:
jharvard@appliance (~/Dropbox/pset2): ./caesar 1 abcdef Segmentation fault (core dumped)
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
You should just run
make caesar! :)
Since you edited your question to a completely different one, a segmentation fault happens when you touch a memory location that you shouldn't touch. It's hard to tell what exactly causes this without seeing your code, but more likely is that you're passing a string instead of a char to a function that accepts a char (e.g.,
Have you tried using GDB? With that you will be able to see exactly which command causes the seg fault, and then you can begin to work out why.
Common reasons would be accessing memory you shouldn't and passing NULL to a function as an argument.
But until you know which bit of code caused the seg fault you won't find out why it did.
Watch all the shorts and walkthroughs, pretty much everything you need to know is in these.
Segmentation fault occurs when accessing the supposedly not accessible chunks of memory. You might have declared the result variable in string and may have initialized to NULL..Instead you can try using array of char..like char and store your results. This is just a hint. After all you have to try it for yourself. As other responders suggested, do watch the shorts and walk-through, they are most helpful!