-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamic_update.c
More file actions
56 lines (52 loc) · 1.07 KB
/
dynamic_update.c
File metadata and controls
56 lines (52 loc) · 1.07 KB
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
47
48
49
50
51
52
53
54
55
56
#include<stdio.h>
struct stud
{
int rollno;
char name[20];
float percent;
};
void addstud(struct stud *s)
{
printf("Enter the student Rollno:");
scanf("%d", &s->rollno);
printf("Enter student Percentage:");
scanf("%f",&s->percent);
printf("Enter the Name: ");
scanf("%s", & s->name);
}
void showstud (struct student s)
{
printf("Now Displaying Student Details as:\n");
printf("\n Name:%s", s.name);
printf("\n RollNumber:%d", s.rollno);
printf("\n Marks: %f", s.percent);
}
void updatemark (struct stud *s)
{
int marks;
printf("\nEnter the new marks");
scanf("%d", &marks);
s->percent=nmarks;
}
int main()
{
int i,troll;
int n;
struct stud *s[10];
printf(\n "How many student in the class:");
scanf("%d", &n);
for(i=0;i<3;i++)
{
s[i]=(struct stud*)malloc(sizeof(struct stud));
addstud(&s[i]);
}
printf("\nEnter the roll number of student whose marke to be update:";
scanf("%d",&troll);
for(i=0;i<3;i++)
{
if(s[i].rollno==troll)
{
updatemark(&a[i]);
}
}
}