In a loop just use the mod operator to switch between upper and lower case
int main()
{
char str[] = "Hello World";
int i;
for(i = 0; str[i] != 0; i++)
{
if( (i % 2) == 0)
str[i] = tolower(str[i]);
else
str[i] = toupper(str[i]);
}
printf("%s\n", str);
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343