Write a c program to create student structure having field roll_no, stud_name, class. Pass this entire structure to function and display the structure element

#include<stdio.h>
#include<conio.h>
struct stud
{
int roll_no;
char stud_name[20];
int std;
};
void main()
{
void student(struct stud );
struct stud s;
clrscr();
printf("\n enter the student name roll no and class\n");
printf("\n enter the student roll no =");
scanf("%d",&s.roll_no);
printf("\n enter the name =");
scanf("%s",s.stud_name);
printf("\n enter the student class =");
scanf("%d",&s.std);
student(s);
getch();
}
void student(struct stud s)
{
printf("\n roll no=%d",s.roll_no);
printf("\n\n name=%s",s.stud_name);
printf("\n\n class=%d",s.std);
}

No comments:

Post a Comment