#include <ctype.h>
#include <stdio.h>
void toTitleCase(char *str) {
int newWord = 1;
while (*str) {
if (isspace((unsigned char)*str)) {
newWord = 1;
} else {
if (newWord) {
*str = toupper((unsigned char)*str);
newWord = 0;
} else {
*str = tolower((unsigned char)*str);
}
}
str++;
}
}
int main() {
char str[] = "c is a General-purpose computer PROgramming LANGuage";
toTitleCase(str);
printf("%s\n", str);
return 0;
}
/*
run:
C Is A General-purpose Computer Programming Language
*/