#include<stdio.h>
int main()
{
char text[100];
int i;
printf("Enter any string: ");
gets(text);
printf("Entered string is: %s\n",text);
for(i=0;text[i]!='\0';i++)
{
if((text[i]>='A' && text[i]<='Z')||(text[i]>='a' && text[i]<='z'))
{
if(text[i]>='A' && text[i]<='Z')
text[i]=text[i]+0x20;
else
text[i]=text[i]-0x20;
}
}
printf("String after toggle case: %s\n",text);
return 0;
}
C Programming
Program to toggle case of all characters of string.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
