Monday, 21 May 2012

a program to print the structure variable pass in function


122./*Write a program to print the structure variable pass in function*/

#include<stdio.h>
#include<conio.h>
struct student
{
            int rollno;
            char name[40];
            };
            void main()
            {
            struct student s1;
            clrscr();

            printf("Enter roll number and name of the student:\n");
            scanf("%d%s",&s1.rollno,s1.name);
            display(s1);
            getch();
            }
            display(struct student s)
            {
             printf("\nThe roll number of the student is:%d\n",s.rollno);
             printf("\nThe name of the student is:%s",s.name);
}

OUTPUT

            Enter roll number and name of the student:
            23 RAM KUMAR
           
            The roll number of the student is: 23
           
The name of the student is: RAM KUMAR

No comments:

Post a Comment