#include<stdio.h>
#include<conio.h>
struct student
{
int rollno;
char name[30];
int age;
};
void main()
{
int records,i;
struct student *s;
printf("How many records u want to enter \n");
scanf("%d",&records);
s=(struct student *)calloc(records,sizeof(struct student));
for(i=0;i<records;i++)
{
printf("\n Enter the rollno");
scanf("%d",&s[i].rollno);
printf("\n Enter the name");
scanf("%s",s[i].name);
printf("\n Enter the age");
scanf("%d",&s[i].age);
}
for(i=0;i<records;i++)
{
printf("\n Rollno:%d",s[i].rollno);
printf("\n Name:%s",s[i].name);
printf("\n Age:%d",s[i].age);
}
getch();
}
#include<conio.h>
struct student
{
int rollno;
char name[30];
int age;
};
void main()
{
int records,i;
struct student *s;
printf("How many records u want to enter \n");
scanf("%d",&records);
s=(struct student *)calloc(records,sizeof(struct student));
for(i=0;i<records;i++)
{
printf("\n Enter the rollno");
scanf("%d",&s[i].rollno);
printf("\n Enter the name");
scanf("%s",s[i].name);
printf("\n Enter the age");
scanf("%d",&s[i].age);
}
for(i=0;i<records;i++)
{
printf("\n Rollno:%d",s[i].rollno);
printf("\n Name:%s",s[i].name);
printf("\n Age:%d",s[i].age);
}
getch();
}
No comments:
Post a Comment