Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(void)
- {
- // these are the letters we are going to change to uppercase
- char vowels[] = {'a', 'e', 'i', 'o', 'u'};
- // this is the string we are going to perform the operation on
- char *str = "Hello World";
- // iterator for the inner for-loop
- int i;
- // while we haven't reached the null terminator
- for (; *str != '\0'; str++)
- {
- // storing the current character we're checking
- char current_char = *str;
- // looping through to see if the character is a lowercase vowel
- for (i = 0; i < 5; i++)
- {
- char current_vowel = vowels[i];
- // if it is, make it upper case
- if (current_char == current_vowel)
- {
- // 32 is the delta between 'a' and 'A' or 97-65
- current_char -= 32;
- }
- }
- printf("%c", current_char);
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement