Skip to content

Instantly share code, notes, and snippets.

@6uclz1
Created November 16, 2015 06:48
Show Gist options
  • Save 6uclz1/08a4defd11a56d38a53d to your computer and use it in GitHub Desktop.
Save 6uclz1/08a4defd11a56d38a53d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int count_vowel(char*);
int main()
{
char *str1, *str2;
str1 = "now is the time";
str2 = "My name is DENDAI Hanako";
printf("%s,vowel:%d\n", str1, count_vowel(str1));
printf("%s,vowel:%d\n", str2, count_vowel(str2));
}
int count_vowel(char *s)
{
int n;
for(n = 0; *s != '\0'; s++)
if(*s == 'a' || *s == 'i' || *s == 'u' || *s == 'e' || *s == 'o' ||
*s == 'A' || *s == 'I' || *s == 'U' || *s == 'E' || *s == 'O')
n++;
return n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment