Skip to content

Instantly share code, notes, and snippets.

@wingyplus
Created January 20, 2017 15:48
Show Gist options
  • Save wingyplus/9f1ae07c2c66a77e2dd323ddc298761f to your computer and use it in GitHub Desktop.
Save wingyplus/9f1ae07c2c66a77e2dd323ddc298761f to your computer and use it in GitHub Desktop.
#include <stdio.h>
int count_vowe(const char *text) {
const char *ch = text;
int count = 0;
for (; *ch != '\0'; ch++) {
switch (*ch) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
count++;
}
}
return count;
}
int main(void) {
printf("vowe = %d\n", count_vowe("aeiou"));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment