#include<stdio.h> |
#include<alloc.h> |
struct student |
{ |
int roll_no; |
char name[30]; |
float marks; |
}; |
void main() |
{ |
int i,n; |
struct
student *s,*t; |
printf("\nEnter The No. of
Students :"); |
scanf("%d",&n); |
s=(struct
student *)malloc(n*sizeof(struct student)); // Allocating
Memory |
t=s; |
for(i=0;i<n;i++,t++) |
{ |
printf("\nEnter The Name, Marks
: "); |
t->roll_no=i; |
scanf("%s",&t->name); |
scanf("%f",&t->marks); |
} |
t=s; |
// Displaying
Information |
printf("\n\nInformation :"); |
printf("\n\n\Roll No.\tName \tMarks"); |
for(i=0;i<n;i++,t++) |
{ |
printf("\n\t%d\t%s\t%f",t->roll_no,t->name,t->marks); |
} |
free(s); |
} |