structure and function in c

Solutions on MaxInterview for structure and function in c by the best coders in the world

showing results for - "structure and function in c"
Margot
02 Jun 2016
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
Jules
26 Apr 2020
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
Daxon
08 Sep 2018
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
queries leading to this page
can we define functions in structure in cfunction as structure memeber function in a structure in cstruct function in ccan i make struct specific functions in cfunction while using structures arguments in cstructures with functions in cstuctures and functions in cstruct functions cstructure in function in ccan we declare function inside structure of c programming 3fstructure of a c programwhy do we declare a structure as function in cfunction in structure in chow can i call the function using structure in cstructure in c declare pass strucure in a function use struct in function cstructure cpass structure to a functiondefine a structure in chow to return a struct in cfunctions using structures in examplesstructure declaration in cstructure in functionpass structure as argument in function in cstructure in c in functionfunction inside structure in ccalling a function from structure in cstructure and functions in cc function return structcan we write a function in c structurec data structure and function examplecan we write a function in a c structurecan we write function inside structure in cstructure function c programstructure and function in cfunctions using structures in cdefine a function in a struct in cfunction struct in ccreating structure in chow to pass a structure member variable to a structure functionpassing structures to functions in cusing functions in structureshow to use struct in functions cfunctions in structures in cfunctions in structure in cstructure as a function argumentstructure of functionsin cc structure functionsaccepting a struct in a functistructure vs function in cc struct function definitionpass by reference structure in cstruct and functions in cfunction in structurec programs using structures and functionsstructure define in chow to pass structure in function in cstructure program with function in cfunction in struct in c languagecan you put function inside structure of c programmingstruct with arguments in chow to use struct in functionstructure function in cdefine structure in ccan we declare function inside structure of c programming 3f 2astruct and functions cwhay 3dt is actually passes if you pass structure variable to a functionc struct functionhow to pass structure into functionsfunction structure in ccan we declare a function inside the structure of c programminghow to pass a struct to a functionhow to use a structure in a function in cfunction in structure cfunction in c structfunciton call in structure in cstructure passing function in cstructure in c using functionsfunction in a structure in cpassing structure to functionhow to pass structures to functions in cdeclare structure function in cstructure in c with functionsc program structure with functionstructures and functions in cpass structure as function argumenthow to pass structure to functionstruct in different function chow to pass structure into a functionc function with structuredefine a structure with functions in cpassing structure member to function in cstructure and functionsstruct as a function in cstruct output parameter structures in functions in cstructure with function in cstruct in c with functionscreate struct and pass it inncan structure have function in cstruct functionscan we use function in structure of c programmingpass structure in function cstruct and fuctions chow to structure to function in c languagestructure operations in cwrite functions within a structure in cstructure in ccan we declare function in structure in cstructure and function in c