Pass nested structure to function Dry Run in C

Pass nested structure to function is an interactive C dry run visualizer from the Struct Functions Pointers 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.

Pass nested structure to function Program Code

#include <stdio.h>

struct Date {
    int day;
    int month;
    int year;
};

struct Employee {
    int empId;
    char name[50];
    struct Date joiningDate;
    float salary;
};

void displayEmployee(struct Employee e) {
    printf("Employee ID: %d\n", e.empId);
    printf("Name: %s\n", e.name);
    printf("Joining Date: %d/%d/%d\n", 
           e.joiningDate.day, 
           e.joiningDate.month, 
           e.joiningDate.year);
    printf("Salary: ₹%.2f\n", e.salary);
}

int main() {
    struct Employee emp = {201, "David Miller", {15, 6, 2020}, 75000.00};
    displayEmployee(emp);
    return 0;
}

View the complete Struct Functions Pointers programs page.

Program Console Pass nested structure to function Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.