Tried to explain it the best I could using the comments. It's a fairly straightforward method. I haven't tested it, but it should work without any issues.
// Traverse through the entire string (noted as "str")
for(unsignedint index = 0; index < strlen(str); index++) {
staticbool bMakeUppercase = true; // By default we make the first letter uppercase (assuming it's even a letter!)
// Spaces indicate new words
if(str[index] == ' ') {
bMakeUppercase = true;
}
// If we have encountered a space, then we need to make the letter capitalized.
// The letter is also lowercase a-z
if(bMakeUppercase && str[index] >= 'a' && str[index] <= 'z') {
bMakeUppercase = false;
str[index] = str[index] - 32; // Difference from 'a' to 'A' is -32 (ASCII tables come in handy here!)
}
}