The following is my code for pset2 initials 2017 and I got a segmentation error. Can someone plse help me debug this.
int n = 1;
printf("Hello what's your name?\n");
string name = get_string();
printf("%c",toupper(name[0]));
while(1 <= n <= strlen(name))
{
if(name[n] == ' ')
{
printf("%c",toupper(name[n+1]));
}
n++;
}
printf("\n");
Now here's the output :
Hello what's your name?
ansh parashar
APSegmentation fault
Please help me find the way to fix this segmentation fault.