1#include <stdio.h>
2#include <string.h>
3
4struct student
5{
6 int id;
7 char name[20];
8 float percentage;
9};
10
11void func(struct student *record);
12
13int main()
14{
15 struct student record;
16
17 record.id=1;
18 strcpy(record.name, "Raju");
19 record.percentage = 86.5;
20
21 func(&record);
22 return 0;
23}
24
25void func(struct student *record)
26{
27 printf(" Id is: %d \n", record->id);
28 printf(" Name is: %s \n", record->name);
29 printf(" Percentage is: %f \n", record->percentage);
30}
31
1#include <stdio.h>
2#include <string.h>
3
4struct student
5{
6 int id;
7 char name[20];
8 float percentage;
9};
10
11void func(struct student record);
12
13int main()
14{
15 struct student record;
16
17 record.id=1;
18 strcpy(record.name, "Raju");
19 record.percentage = 86.5;
20
21 func(record);
22 return 0;
23}
24
25void func(struct student record)
26{
27 printf(" Id is: %d \n", record.id);
28 printf(" Name is: %s \n", record.name);
29 printf(" Percentage is: %f \n", record.percentage);
30}
31
1#include <stdio.h>
2#include <string.h>
3
4struct student
5{
6 int id;
7 char name[20];
8 float percentage;
9};
10struct student record; // Global declaration of structure
11
12void structure_demo();
13
14int main()
15{
16 record.id=1;
17 strcpy(record.name, "Raju");
18 record.percentage = 86.5;
19
20 structure_demo();
21 return 0;
22}
23
24void structure_demo()
25{
26 printf(" Id is: %d \n", record.id);
27 printf(" Name is: %s \n", record.name);
28 printf(" Percentage is: %f \n", record.percentage);
29}
30