#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main (void){
string name = GetString();
printf("%c", toupper (name[0]));
for (int i = 0 ; i < strlen(name) ; i++)
{
if(i == '\0'){
printf("%c", toupper (name[i+1]));
}
}
printf("\n");
}
Everytime I run my code above I only get the first 2 characters of my input captalized:
./initials
Jake Steevens
JA
Shouldn't the for loop go through every character typed and, after it finds the '\0' (space), print out the next character?