Nested structure (structure inside structure) Dry Run in C

Nested structure (structure inside structure) 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.

Nested structure (structure inside structure) Program Code

#include <stdio.h>

// Inner structure
struct Date {
    int day;
    int month;
    int year;
};

// Outer structure containing Date
struct Employee {
    int empId;
    char name[50];
    struct Date joiningDate;  // Nested structure
    float salary;
};

int main() {
    struct Employee emp = {
        101,
        "Rajesh Kumar",
        {15, 8, 2020},  // Nested initialization for joiningDate
        55000.00
    };
    
    printf("Employee ID: %d\n", emp.empId);
    printf("Name: %s\n", emp.name);
    printf("Joining Date: %d/%d/%d\n", 
           emp.joiningDate.day, 
           emp.joiningDate.month, 
           emp.joiningDate.year);
    printf("Salary: Rs.%.2f\n", emp.salary);
    
    return 0;
}

View the complete Structures programs page.

Program Console Nested structure (structure inside structure) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.