POINTER TO STRUCTURE PROGRAMM:::
#include<stdio.h>
#include<conio.h>
struct student
{
char name[20];
int roll_no;
};
void main()
{
struct student stu[3],*ptr;
clrscr();
printf("\n Enter data\n");
for(ptr=stu;ptr<stu+3;ptr++)
{ printf("Name");
scanf("%s",ptr->name);
printf("roll_no");
scanf("%d",&ptr->roll_no);
}
printf("\nStudent Data\n\n");
ptr=stu;
while(ptr<stu+3)
{
printf("%s %5d\n",ptr->name,ptr->roll_no);
ptr++;
}
getch(
No comments:
Post a Comment