I have programmed a Programm that reverses me every Word in an array but my problem is i wanna have the first Letter of a Word in uppercases and all the other in lowercase.
C
#include <stdio.h>
#include<stdlib.h>
#include<ctype.h>
char * reversePrint( char *name )
{
char *input_string = name;
char temp;
while (*input_string)
{
char *t = input_string;
/* End of non Whitespace sequence */
while (*t && *t == (unsigned char)*t && !isspace(*t))
{
t++;
}
if (t - input_string > 1)
{
/* Non whitespace Sequence >1*/
char *e = t;
/* Reverse Words */
do
{
char temp = *input_string;
*input_string++ = *--e;
*e = temp;
}
while (input_string < e);
//Paste reversed Sequence
input_string = t;
}
else
{
//Non whitepace skip
input_string++;
}
}
return name;
}
int main( void )
{
char s[] = "I love Pizza";
printf("%s", reversePrint(s));
return 0;
}
So my Problem is i get as a Result I Evol azziP but i have to have I evol Azzip
Can anyone help me out?