Showing posts with label members. Show all posts
Showing posts with label members. Show all posts

Saturday 30 July 2016

Passing Individual Structure Members to Function

Passing Individual Structure Members to Function


#include<stdio.h>
void display(char nam[], int roll, float mrk);

struct student
{
            char name[20];
            int rollno;
            float mark;
};
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.name, S1.rollno, S1.mark );
}
void display(char nam[], int roll, float mrk)
{
            printf("\n Name is %s \n Rollno is %d \n Mark is %f", nam, roll, mrk );
}

Output:
Enter name rollno and mark of a student:     aaa          11        80
 Name is aaa
 Rollno is 11
 Mark is 80.000000


Goto Main Content:
https://tejaswinihbhat.blogspot.in/2016/07/data-structures-15CS33-Module1.html
https://tejaswinihbhat.blogspot.in/2016/07/structures.html