Program Console Vignaankosh.com
Execution Panel
Console is empty.
Input and display array of structures is an interactive C dry run visualizer from the Structures 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.
#include <stdio.h>
struct Student {
int id;
char name[40];
float marks;
};
void inputStudents(struct Student s[], int n) {
for(int i = 0; i < n; i++) {
printf("Student %d:\n", i+1);
printf("ID: "); scanf("%d", &s[i].id);
printf("Name: "); scanf(" %[^\n]", s[i].name);
printf("Marks: "); scanf("%f", &s[i].marks);
}
}
void displayStudents(struct Student s[], int n) {
printf("\n%-5s %-25s %-8s\n", "ID", "Name", "Marks");
printf("%-5s %-25s %-8s\n", "--", "----", "-----");
for(int i = 0; i < n; i++) {
printf("%-5d %-25s %-8.2f\n", s[i].id, s[i].name, s[i].marks);
}
}
int main() {
struct Student students[50];
int n;
printf("Enter number of students: ");
scanf("%d", &n);
inputStudents(students, n);
displayStudents(students, n);
return 0;
}