Code for the second initial:

for (int i = 0; i < strlen(name); i++)

            if (i == isspace(name))
            printf("%c\n", toupper(name[i+1]));

gives me a segmentation fault?


One problem is here: printf("%c\n", toupper(name[i+1]));
Your code iterates from i = 0 to i = strlen(name) - 1, on the last iteration you're trying to acess name[strlen(name)], which is outside the boundaries of the array by definition.
Also, line if (i == isspace(name)) feels weird, isspace checks if a character is space but you're passing a string as parameter.
If you're having trouble figuring what a function does you can use command man, for example:
man isspace where you can read about the function.
If this answers your question please mark as answered.

You must log in to answer this question.

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