Store RGB Image Data (Height × Width × Channels) Dry Run in C

Store RGB Image Data (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 RGB Image Data (Height × Width × Channels) Program Code

#include <stdio.h>
int main() {
    int height = 3, width = 4, i, j;
    unsigned char image[3][4][3];
    
    for(i =0;i<height;i++)
        for(j =0;j<width;j++) {
            image[i][j][0] = (i+j) * 30;  // Red channel
            image[i][j][1] = 0;            // Green channel
            image[i][j][2] = 0;            // Blue channel
        }
    
    printf("RGB Image (%d×%d):\n", height, width);
    printf("Pixel(0,0): R=%d G=%d B=%d\n", 
           image[0][0][0], image[0][0][1], image[0][0][2]);
    return 0;
}

View the complete Multi D programs page.

Program Console Store RGB Image Data (Height × Width × Channels) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.