Program that prints out the initials of a given name #include &lt;string.h&gt;
#include &lt;cs50.h&gt;
#include &lt;stdio.h&gt;
#include &lt;ctype.h&gt;

int main(void)
{
    // store user input
    char * name = get_string();

    // print out the first character of firts string
        printf("%c", toupper(name[0]));

    // iterate through name
    for (int i = 0, n = strlen(name); i &lt; n; i++)
    {
        // if i'th character is a space print next character as uppercase
        if (name[i - 1] == ' ')
        {
            printf("%c", toupper(name[i]));

        }

    }
    // print new line following initials
    printf("\n");

}


It does what it's supposed to do but I'm concerned about the style of the program.
Your code is buggy. It might seem to work, but accessing name[-1] invokes undefined behavior. You do that in the first iteration of the for loop. To fix it, start at i = 1 instead of i = 0.

The next instance of undefined behavior is when you call toupper(name[i]). The functions from &lt;ctype.h&gt; must not be called with a char as their argument. It must always be an unsigned char or the value of the macro EOF. To fix this, call toupper((unsigned char) name[i]).

The proper type for array indexes is not int, but size_t. Therefore the loop should start with for (size_t i = 1, n = strlen(name).

You have a typo: firts instead of first.

Other than that, the code looks good. In some months you will be able to remove all the comments because they are obvious to you. But until then, they should stay.

To make your program even more correct, you could change the condition name[i - 1] == ' ' to be more precise: !isalpha((unsigned char) name[i - 1]) &amp;&amp; isalpha((unsigned char) name[i]). Then you won't print an "uppercase space" if the input contains several spaces in a row.