Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- typedef struct student
- {
- int roll;
- char name[20];
- int fees;
- };
- struct student *ptr[3];
- void main()
- {
- int i;
- clrscr();
- for(i=0; i<3; i++)
- {
- ptr[i] = (struct student *)malloc(sizeof(struct student));
- printf("\nEnter Num : %d",(i+1));
- printf("\nEnter Roll :");
- scanf("%d",&ptr[i]->roll);
- fflush(stdin);
- printf("Enter Name:");
- fflush(stdin);
- gets(ptr[i]->name);
- printf("Enter Fees :");
- scanf("%d",&ptr[i]->fees);
- }
- for(i=0; i<3; i++)
- {
- printf("\nRoll No : %d",ptr[i]->roll);
- printf("\nName : %s",ptr[i]->name);
- printf("\nFees : %d",ptr[i]->fees);
- }
- getch();
- }
Add Comment
Please, Sign In to add comment