Passing Structure Variable to Function
#include<stdio.h>
void
display(struct student);
struct
student
{
char name[20]; int
rollno; float mark;
};
void main()
{
struct student S1;
printf("\nEnter name rollno and
mark of a student:");
scanf("%s
%d %f", S1.name, &S1.rollno, &S1.mark );
display(S1);
}
void display(struct student stu)
{
printf("\n
Name is %s \n Rollno is %d \n Mark is %f", stu.name, stu.rollno, stu.mark );
}
Output:
Enter name
rollno and mark of a student: aaa 11 80
Name is aaa
Rollno is 11
Mark is 80.000000