Structure with array member Dry Run in C

Structure with array member is an interactive C dry run visualizer from the Structures 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.

Structure with array member Program Code

#include <stdio.h>

struct Semester {
    int rollNo;
    char name[30];
    int subjectMarks[6];  // Array member - marks for 6 subjects
    char subjects[6][20]; // 2D array - subject names
};

int main() {
    struct Semester s1 = {
        101,
        "Ananya Verma",
        {85, 90, 78, 92, 88, 95},  // Marks array
        {"Math", "Physics", "Chemistry", "CS", "English", "Electronics"}
    };
    int i;
    
    printf("Student: %s (Roll: %d)\n", s1.name, s1.rollNo);
    printf("\n--- Subject-wise Marks ---\n");
    
    for(i = 0; i < 6; i++) {
        printf("%-12s : %d\n", s1.subjects[i], s1.subjectMarks[i]);
    }
    
    return 0;
}

View the complete Structures programs page.

Program Console Structure with array member Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.