Pass array to function and print elements Dry Run in C

Pass array to function and print elements is an interactive C dry run visualizer from the Functions 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.

Pass array to function and print elements Program Code

#include <stdio.h>

// Function to print array elements
void printArray(int arr[], int size) {
    for(int i = 0; i < size; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
}

int main() {
    int numbers[] = {10, 20, 30, 40, 50};
    int n = sizeof(numbers) / sizeof(numbers[0]);
    
    printf("Array elements: ");
    printArray(numbers, n);
    return 0;
}

View the complete Functions programs page.

Program Console Pass array to function and print elements Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.