R18 Count vowels recursively Dry Run in C

R18 Count vowels recursively is an interactive C dry run visualizer from the Recursion programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

R18 Count vowels recursively Program Code

#include <stdio.h>

int isVowel(char ch) {
    ch = (ch >= 'A' && ch <= 'Z') ? ch + 32 : ch;
    return (ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u');
}

int countVowels(char str[], int index) {
    if(str[index] == '\0') {
        return 0;
    }

    char currentChar = str[index];
    int countFromRest = countVowels(str, index + 1);
    int currentCount;

    if(isVowel(currentChar)) {
        currentCount = 1;
    } else {
        currentCount = 0;
    }

    int totalCount = currentCount + countFromRest;
    return totalCount;
}

int main() {
    char text[] = "Programming is Fun";
    int vowels = countVowels(text, 0);
    printf("String: %s\n", text);
    printf("Number of vowels: %d\n", vowels);
    return 0;
}

View the complete Recursion programs page.

Program Console R18 Count vowels recursively Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.