Store and print user details using array (Real-world example) Dry Run in C

Store and print user details using array (Real-world example) is an interactive C dry run visualizer from the Arrays 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 and print user details using array (Real-world example) Program Code

#include <stdio.h>
int main() {
    int n, i;
    printf("Enter number of students: ");
    scanf("%d", &n);
    
    int roll[n];
    char name[n][50];
    float marks[n];
    
    // Input details
    for(i = 0; i < n; i++) {
        printf("\nStudent %d:\n", i+1);
        printf("Enter roll number: ");
        scanf("%d", &roll[i]);
        printf("Enter name: ");
        scanf("%s", name[i]);
        printf("Enter marks: ");
        scanf("%f", &marks[i]);
    }
    
    // Display details
    printf("\n\n========== STUDENT DETAILS ==========\n");
    printf("Roll\tName\t\tMarks\n");
    printf("------------------------------------\n");
    for(i = 0; i < n; i++) {
        printf("%d\t%s\t\t%.2f\n", roll[i], name[i], marks[i]);
    }
    
    return 0;
}

View the complete Arrays programs page.

Program Console Store and print user details using array (Real-world example) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.