having a hard time with this problem set. no problem in getting first letter, it's the letters that follow a space that are giving me a hard time. any hints appreciated.
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
//prompt user for name
string s = get_string();
if (s != NULL)
{
//first letter
for(int i = 0, n = strlen(s); i < n; i++)
{
if (i < 1)
{
printf("%c", toupper(s[i]));
i++;
}
// for letter after space?
for (;s[i] != ' '; i++); //receiving seg fault in this line
i++;
printf("%c", toupper(s[i]));
}
}
printf("\n");
}