Virajsinh

B_PRM_10

Oct 13th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. typedef struct student
  5. {
  6.     int roll;
  7.     char name[20];
  8.     int fees;
  9. };
  10.  
  11. struct student *ptr[3];
  12.  
  13. void main()
  14. {
  15.     int i;
  16.     clrscr();
  17.     for(i=0; i<3; i++)
  18.     {
  19.         ptr[i] = (struct student *)malloc(sizeof(struct student));
  20.         printf("\nEnter Num : %d",(i+1));
  21.         printf("\nEnter Roll :");
  22.         scanf("%d",&ptr[i]->roll);
  23.         fflush(stdin);
  24.         printf("Enter Name:");
  25.         fflush(stdin);
  26.         gets(ptr[i]->name);
  27.         printf("Enter Fees :");
  28.         scanf("%d",&ptr[i]->fees);
  29.     }
  30.     for(i=0; i<3; i++)
  31.     {
  32.         printf("\nRoll No : %d",ptr[i]->roll);
  33.         printf("\nName : %s",ptr[i]->name);
  34.         printf("\nFees : %d",ptr[i]->fees);
  35.     }
  36.     getch();
  37. }
Add Comment
Please, Sign In to add comment