-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure1.c
More file actions
40 lines (38 loc) · 997 Bytes
/
structure1.c
File metadata and controls
40 lines (38 loc) · 997 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
// This program takes inputs of students data and print their data back to them
#include<stdio.h>
struct student {
int rollno;
char name[50];
float height;
};
void studentDataEntry( struct student *a);
void checkRecords(struct student a );
int main()
{
int noOfRecords;
printf("How many records you want to enter :");
scanf("%d",&noOfRecords);
struct student records[noOfRecords];
for(int i=0;i<noOfRecords;i++)
{
studentDataEntry(&records[i]);
}
printf("Students Records \n");
for(int i=0;i<noOfRecords;i++)
{
checkRecords(records[i]);
}
}
void studentDataEntry( struct student *a)
{
printf("Enter your roll no :");
scanf("%d",&a->rollno);
printf("Enter your name :");
scanf(" %[^\n]s",a->name);
printf("Enter your height :");
scanf("%f",&a->height);
}
void checkRecords(struct student a)
{
printf("Roll : %d , Student Name : %s ,Height : %f \n",a.rollno,a.name,a.height);
}