Getting a segmentation fault in line 21, never seen this before and don't know how to fix it. Anyone might point me in the right direction?
#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");
}