Sunday 11 December 2011

Write a program to print structure’s element pass in function in c

#include
#include
main()
{
struct student
{
int rollno;
char name[40];
};
struct student s1;
clrscr();
printf("Enter roll number and name of the student;\n");
scanf("%d%s",&s1.rollno,s1.name);
display(s1.rollno,s1.name);
getch();
}
display(int x,char *s)
{
printf("\nThe roll number of the student is:%d\n",x);
printf("\nThe name of the student is:%s",s);
}
OUTPUT
Enter roll number and name of the student: 30 SYAM LAL
The roll number of the student is: 30
The name of the student is : SYAM LAL

No comments:

Post a Comment