Store Batch of Images (Batch × Height × Width × Channels) Dry Run in C

Store Batch of Images (Batch × Height × Width × Channels) 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.

Store Batch of Images (Batch × Height × Width × Channels) Program Code

#include <stdio.h>
int main() {
    int batch=2, height=2, width=3, b, h, w, c;
    int images[2][2][3][3];
    
    for(b =0;b<batch;b++)
        for(h =0;h<height;h++)
            for(w =0;w<width;w++)
                for(c =0;c<3;c++) {
                    if(b==0) images[b][h][w][c] = (h*width+w)*20;
                    else images[b][h][w][c] = ((h+w)%2==0)?255:0;
                }
    
    printf("Image0 pixel(0,0): (%d,%d,%d)\n",
           images[0][0][0][0], images[0][0][0][1], images[0][0][0][2]);
    return 0;
}

View the complete Multi D programs page.

Program Console Store Batch of Images (Batch × Height × Width × Channels) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.