Yes of course you can do it.
You have to just play with the ASCII values of letters for example (ASCII value of 'A' is 65 and 'Z' is 90 and for 'a' is 97 and for 'z' is 122).
So here is the trick if you want to convert a capital letter to small then you have to add 32 to that character
and from small to capital then you have to subtract 32 from that character, because of difference of
the ASCII value of ('A' to 'a' is 32 --> [97 - 65 = 32]).
Here is my code (Tested).
#include <stdio.h>
int main()
{
char str[50] = "this is a simple Example!";
int i;
printf("String before change : %s\n", str);
for (i = 0; str[i]; i++) {
if ((i == 0) || ((i != 0) && (str[i - 1] == ' '))) {
if (str[i] >= 'a' && str[i] <= 'z') {
str[i] -= 32;
}
}
}
printf("String After change : %s\n", str);
return 0;
}
Feel free to ask :)