Take 4D Array Input from User Dry Run in C

Take 4D Array Input from User is an interactive C dry run visualizer from the Multi D 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.

Take 4D Array Input from User Program Code

#include <stdio.h>
int main() {
    int w,x,y,z, i, j, k, l;
    printf("Enter dimensions (W X Y Z): ");
    scanf("%d %d %d %d", &w, &x, &y, &z);
    
    int arr[w][x][y][z];
    printf("Enter %d elements:\n", w*x*y*z);
    
    for(i =0;i<w;i++)
        for(j =0;j<x;j++)
            for(k =0;k<y;k++)
                for(l =0;l<z;l++) {
                    printf("arr[%d][%d][%d][%d] = ", i,j,k,l);
                    scanf("%d", &arr[i][j][k][l]);
                }
    
    printf("First element: %d\n", arr[0][0][0][0]);
    return 0;
}

View the complete Multi D programs page.

Program Console Take 4D Array Input from User Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.