A Program in c demonstrating the use of
Static memory allocation.
#include<stdio.h>
#include<conio.h>
void
main()
{
int
i,n,s[50];
clrscr();
printf("\n\t\t
Static memory allocation\n");
printf("\n
Enter the no of student:- ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n
Enter marks of %d student:- ",i+1);
scanf("%d",&s[i]);
}
printf("\n\n
Marks of students are:");
for(i=0;i<n;i++)
printf("\n\nMarks
of %d student:-%d ",i+1,s[i]);
getch();
}
output:
Static
memory allocation
Enter the no of student:- 5
Enter marks of 1 student:- 85
Enter marks of 2 student:- 65
Enter marks of 3 student:- 78
Enter marks of 4 student:- 58
Enter marks of 5 student:- 74
Marks
of students are:
Marks
of 1 student:-85
Marks
of 2 student:-65
Marks
of 3 student:-78
Marks
of 4 student:-58
Marks of 5 student:-74
No comments:
Post a Comment