basics · beginner · ~15 min

Count vowels

Loop over a string testing membership.

Challenge

Implement int count_vowels(const char *s) returning the number of vowels (a,e,i,o,u, lower-case only) in s.

Starter code

int count_vowels(const char *s) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.