0
int main(int argc, string argv[])
{
    string keyword = argv[1];
    if (argc != 2)
    {    
        printf("Please reenter with a cipher keyword);
        return 1;
    }
    if (isalpha(keyword))
    {
        printf("Keyword is %s\n", keyword);
    }
    else
    {
        printf("Keyword must be alphabetical\n");
        return 1;
    } 
3

First issue is that you blindly get argv[1] before actually checking the number of arguments. The segfault, however, comes from the fact you are passing a string to isalpha, whose argument is actually a char (see cs50 reference).

You must log in to answer this question.

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