Search⌘ K
AI Features

Solution: Uppercase the String

Explore how to convert all lowercase letters in a string to uppercase using C. Understand ASCII value manipulation and loop control to modify strings effectively in C programming.

We'll cover the following...
C
#include <stdio.h>
char * toUpperCase(char * province)
{
int i = 0;
while (province[i] != 0)
{
if ((province[i] >= 'a') && (province[i] <= 'z'))
{
province[i] = province[i] - 32;
}
i++;
}
return province;
}
int main(void)
{
char province[] = "Ontario";
toUpperCase(province);
printf("Uppercase: %s\n", province);
return 0;
}
...