Structures
Array of Structures
Store records of 3 students and display them.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Store records of 3 students and display them.
#include <stdio.h>
struct Student {
char name[50];
int roll;
};
int main() {
struct Student s[3];
for (int i = 0; i < 3; i++) {
scanf("%s %d", s[i].name, &s[i].roll);
}
for (int i = 0; i < 3; i++) {
printf("%s : %d\n", s[i].name, s[i].roll);
}
return 0;
}
Alice 101
Bob 102
Charlie 103
Alice : 101
Bob : 102
Charlie : 103