Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- //http://fresh2refresh.com/c/c-passing-struct-to-function/
- struct student
- {
- int id;
- char name[20];
- float percentage;
- };
- void func(struct student record);
- int main()
- {
- struct student record;
- record.id=1;
- strcpy(record.name, "Raju");
- record.percentage = 86.5;
- func(record);
- return 0;
- }
- void func(struct student record)
- {
- printf(" Id is: %d \n", record.id);
- printf(" Name is: %s \n", record.name);
- printf(" Percentage is: %f \n", record.percentage);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement