Q:

I am trying to write a program in C that prompts user for a name and then outputs its initials

The following is what I wrote first.  It worked perfectly well for one space between strings. 
int main(void)
{
    string name = GetString();
    printf("%c",toupper(name[0]));

    for (int i = 0; i < strlen(name); i++)
    {
        if (name[i] == ' ')
        {
            i++;
            printf("%c", toupper(name[i]));
        }
    }
    printf("\n");
}

However, since it detects only one space, it won't work for user input with multiple spaces between two strings.  So, I went ahead and created a do while loop as follows:
int main(void)
{
    string name = GetString();
    printf("%c",toupper(name[0]));

    for (int i = 0; i < strlen(name); i++)
    {
        do
        {
            if (name[i] == ' ')
            {
               i++;
               printf("%c", toupper(name[i]));
            }
        }
        while (name[i+1] ! = ' ');
    }
    printf("\n");
}

While I was expecting the loop to do it for me, now, my terminal is only prompting for almost an infinite number of user input of names and printing absolutely nothing.  I cannot seem to be able to detect the error.  This is only my first week programming, help please! 

A:

You can escape the next space by using checking if next is a space simply:
if (name[i] == ' ' && name[i+1] ! = ' ')

in your first program. 
for (int i = 0; i < strlen(name); i++)
    {
        if (name[i] == ' ' && name[i+1] ! = ' ')
        {
            printf("%c", toupper(name[i+1]));
        }
    }

