forked from Anooppandikashala/youtube_c_tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstruct_example.c
More file actions
46 lines (33 loc) · 746 Bytes
/
struct_example.c
File metadata and controls
46 lines (33 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
struct Student
{
int id;
char name[50];
int mark[3];
};
void main()
{
struct Student s[3];
for(int j=0;j<3;j++)
{
printf("Enter the student %d id :",j+1);
scanf("%d",&s[j].id);
printf("Enter student %d name : ",j+1);
scanf("%s",s[j].name);
for(int i=0 ; i<3; i++)
{
printf("Enter the student %d mark %d :",j+1,i+1);
scanf("%d",&s[j].mark[i]);
}
}
for(int j=0;j<3;j++)
{
printf("\nStudent id : %d",s[j].id);
printf("\nStudent name : %s",s[j].name);
printf("\nStudent marks:");
for(int i=0 ; i<3; i++)
{
printf("\nmark %d : %d",i+1,s[j].mark[i]);
}
}
}