Structure with different data types Dry Run in C

Structure with different data types 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 different data types Program Code

#include <stdio.h>

struct Item {
    int itemCode;        // Integer
    char category;       // Character
    double weight;       // Double precision float
    char description[50]; // String (char array)
    float discount;      // Float
};

int main() {
    struct Item itm = {1001, 'E', 12.55, "Electronic Device", 5.5};
    
    printf("Item Code: %d\n", itm.itemCode);
    printf("Category: %c\n", itm.category);
    printf("Weight: %.2lf kg\n", itm.weight);
    printf("Description: %s\n", itm.description);
    printf("Discount: %.1f%%\n", itm.discount);
    
    printf("\nTotal size of struct: %lu bytes\n", sizeof(struct Item));
    
    return 0;
}

View the complete Structures programs page.

Program Console Structure with different data types Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.