String Title case

Q. Write a C program to accept a string from user change it to title case i.e. first character of each word in string must be capital letter.

For example if string is: are you confident to write c programs?
Result: Are You Confident To Write C Program?


/*c program for change case of string or title case of string*/
int main()
 int tmp,i;
 char str[30];
 printf("Enter any string: ");
 for(i=0; str[i]!='\0'; i++)
   if(str[i-1]==' ' || i==0)
     if(str[i]>='a' && str[i]<='z')
       if(str[i]>='A' && str[i]<='Z')
 return 0;


Output of C program of string title case
Screen shot of title case C program

Related programs:

  1. Reverse all string
  2. Reverse all words but not string
  3. Reverse each first character of word & add extra word
  4. Display string vertically
  5. Search sub-string from main string
  6. Search sub-string individual from main string
  7. Position and repetition of character in string