Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program, using pointer to structure, to initialize the members in the
- structure. Use functions to print the student’s information. */
- #include<stdio.h>
- #include<conio.h>
- struct student
- {
- int roll;
- char name[20], course[20];
- float fees;
- };
- void display(struct student*);
- void main()
- {
- struct student *ptr_stud1;
- struct student stud1={1,"Virajsinh","MScIT",45000};
- clrscr();
- ptr_stud1=&stud1;
- display(ptr_stud1);
- getch();
- }
- void display(struct student *ptr_stud1)
- {
- printf("\nRoll No : %d",ptr_stud1->roll);
- printf("\nName : %s",ptr_stud1->name);
- printf("\nCourse : %s",ptr_stud1->course);
- printf("\nFees : %.2f",ptr_stud1->fees);
- }
Add Comment
Please, Sign In to add comment