Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<conio.h>
- #include<stdio.h>
- #include<alloc.h>
- struct student
- {
- int rno;
- char name[20];
- char course[20];
- };
- void display(struct student *ptr)
- {
- printf("\n-------------------------");
- printf("\n Student Roll : %d", ptr->rno);
- printf("\n Student Name : %s", ptr->name);
- printf("\n Student Course : %s", ptr->course);
- printf("\n-------------------------");
- }
- void main()
- {
- struct student *ptr;
- clrscr();
- ptr=(struct student *) malloc(sizeof(struct student));
- printf("\nRoll No. : ");
- scanf("%d", &ptr->rno);
- printf("Name : ");
- scanf("%s", &ptr->name);
- printf("Course : ");
- scanf("%s", &ptr->course);
- display(ptr);
- getch();
- }
Add Comment
Please, Sign In to add comment