I'm struggling with printing the initials after the first name, I'm following the less comfortable specs, my pseudocode;
//prompt user for name and store as string
//convert strlen to an integer
//print first character using toupper for lower case inputs
//using a for loop, print the char directly after a space, again using toupper
My code prints the first character just fine but no following characters, I can assume that there are no extra spaces, the for loop is as follows;
for ( int j = 0; j <= i; j++ )
{
if ( (char)s[j] == ' ')
printf("%c", toupper( s[j + 1] ) );
}
It compiles just fine so it's not a syntax error, any help would be greatly appreciated as I'm getting to the stage of just trying different wording which doesn't really help me much as far as learning goes.
Cheers
i
being declared and computed? Are there anyif
clauses before this loop that would possibly skip it?