CODE
#include <stdio.h>
#include <string.h>
struct student {
char name[50];
int roll;
};
int main() {
struct student student1;
strcpy(student1.name, "Chris Hansen");
student1.roll = 38;
printf("Name: %s\\Roll number: %d\\", student1.name, student1.roll);
struct student student2;
strcpy(student2.name, "Edip Yuksel");
student2.roll = 19;
printf("Name: %s\\Roll number: %d\\", student2.name, student2.roll);
struct student student3;
strcpy(student3.name, "Skeeter Jean");
student3.roll = 57;
printf("Name: %s\\Roll number: %d\\", student3.name, student3.roll);
struct student student4;
strcpy(student4.name, "Sinbad Badr");
student4.roll = 114;
printf("Name: %s\\Roll number: %d\\", student4.name, student4.roll);
struct student student5;
strcpy(student5.name, "Titus Alexius");
student5.roll = 76;
printf("Name: %s\\Roll number: %d\\", student5.name, student5.roll);
return 0;
}
DISPLAY
Name: Chris Hansen
Roll number: 38
Name: Edip Yuksel
Roll number: 19
Name: Skeeter Jean
Roll number: 57
Name: Sinbad Badr
Roll number: 114
Name: Titus Alexius
Roll number: 76
Step-by-step explanation
Use string.h to access string functions for names.
Create a struct outside of the main on student name and roll number.
strcpy works for strings.
Create for 1 student and copy and paste for the others.
Display the name and roll number for each student.