Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    C Program to Remove Vowel Letters from String

    C Programming Examples


    There are five letters A, E, I, O, and U called vowels in English. Except for these five vowels, all other letters are called consonants.

    This C example program removes vowels letters from a user-entered string. It checks the conditions in a user-defined function inside the loop and prints the output to the screen.

    Example C Program:
    #include <stdio.h>
    #include <string.h>
    
    int vowel_check(char); /* Define function prototype. */
    
    int main() {
      /* Variable Declaration and Initialization. */
      char inputs[100], output[100];
      int i, d = 0;
      
      /* taking user input */
      printf("Enter some text:\n");
      gets(inputs);
    
      /* checking and removing the vowels letters */
      for (i = 0; inputs[i] != '\0'; i++) {
        if (vowel_check(inputs[i]) == 0) {
          /* not a vowel  */
          output[d] = inputs[i];
          d++;
        }
      }
      output[d] = '\0';
      strcpy(inputs, output);
      printf("The text after deleting Vowels letters: %s\n", inputs);
      return 0;
    }
    
    /* Function Definition - User Defined Function */
    int vowel_check(char l) {
      if (l == 'a' || l == 'A' || l == 'e' || l == 'E' || l == 'i' || l == 'I' ||
        l == 'o' || l == 'O' || l == 'u' || l == 'U')
        return 1;
      return 0;
    }

    Program Output:

    Enter some text:
    W3schools.in
    The text after deleting Vowels letters: W3schls.n


    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.