Virajsinh

B_PRM_08

Oct 9th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. /* Write a program, using pointer to structure, to initialize the members in the
  2. structure. Use functions to print the student’s information. */
  3.  
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7. struct student
  8. {
  9.     int roll;
  10.     char name[20], course[20];
  11.     float fees;
  12. };
  13.  
  14. void display(struct student*);
  15.  
  16. void main()
  17. {
  18.     struct student *ptr_stud1;
  19.     struct student stud1={1,"Virajsinh","MScIT",45000};
  20.     clrscr();
  21.     ptr_stud1=&stud1;
  22.     display(ptr_stud1);
  23.     getch();
  24. }
  25.  
  26. void display(struct student *ptr_stud1)
  27. {
  28.     printf("\nRoll No : %d",ptr_stud1->roll);
  29.     printf("\nName : %s",ptr_stud1->name);
  30.     printf("\nCourse : %s",ptr_stud1->course);
  31.     printf("\nFees : %.2f",ptr_stud1->fees);
  32. }
Add Comment
Please, Sign In to add comment