Glad to be here. I have a slight issue. I have searched and I want to avoid using 'isalpha' if I can. That seems like the easy way out but I just can't find out how the last 2 checks on the check50 are not working. I suppose it's because they are checking for non-space characters but still...

:) initials.c exists.

:) initials.c compiles.

:) Outputs HLJ for Hailey Lynn James

:) Outputs HLJ for hailey lynn james

:) Outputs HJ for hailey James

:) Outputs B for BRIAN

:( Outputs HJ for hailey James expected "HJ\n", not "H J\n"

:( Outputs HJ for hailey James expected "HJ\n", not " HJ \x00\n"

If only I could see exactly what the input was then I could troubleshoot it better and know exactly what is wrong with the code with debug50.

int main(void)


//Get user name from input

string initials = get_string();

//Verify name is valid
if (initials != NULL)

    //Loop over characters in name printing out specified indexes
    for (int i = 0, name_len = strlen(initials); i < name_len; i++)

        if (i == 0 && i != ' ')
             printf("%c", toupper (initials[i]));
        else if(initials[i] == ' ')
            while(initials[i] == ' ')
                printf("%c", toupper (initials[i]));



It looks to be outputting the end of string marker if there's a space at the end of the string. You might want to rethink the logic.

Also, in the 2nd if statement, is the code supposed to be comparing the value of i to a space, or the contents of initials[i] to a space?

And now for the bad news. It's a new year! While this pset will be a good exercise to finish, it is no longer part of the course for 2018. You'll be doing it for fun only. You need to be working from the 2018 course material, not last year's.

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

  • It did help but I figured out that I need to change the logic when it encounters '/0'. And I thought you could carry over the work :( I started the course mid December. That's a bummer. Jan 7 '18 at 3:54
  • Oh and to answer your question, it worked with the "i" comparison but it works better with initials[i] != ' ' Jan 7 '18 at 4:05
  • And thank you for the response and heads up.... glad i posted a question :) Jan 7 '18 at 4:16
  • The completed, submitted AND GRADED work does carry over. Anything submitted after the new year must come from the 2018 content. But you still get credit for the stuff already graded. And if you get ambitious, you can resubmit any pset, as long as it's the new stuff to replace the old.
    – Cliff B
    Jan 7 '18 at 4:23

You must log in to answer this question.

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