Virajsinh

B_PRM_11

Nov 3rd, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include<conio.h>
  2. #include<stdio.h>
  3. #include<alloc.h>
  4.  
  5. struct student
  6. {
  7.     int rno;
  8.     char name[20];
  9.     char course[20];
  10. };
  11. void display(struct student *ptr)
  12. {
  13.     printf("\n-------------------------");
  14.     printf("\n Student Roll   : %d", ptr->rno);
  15.     printf("\n Student Name   : %s", ptr->name);
  16.     printf("\n Student Course : %s", ptr->course);
  17.     printf("\n-------------------------");
  18. }
  19.  
  20. void main()
  21. {
  22.     struct student *ptr;
  23.     clrscr();
  24.     ptr=(struct student *) malloc(sizeof(struct student));
  25.     printf("\nRoll No. : ");
  26.     scanf("%d", &ptr->rno);
  27.     printf("Name : ");
  28.     scanf("%s", &ptr->name);
  29.     printf("Course : ");
  30.     scanf("%s", &ptr->course);
  31.     display(ptr);
  32.     getch();
  33. }
Add Comment
Please, Sign In to add comment