Post Page Advertisement [Top]

C-Programming

what is Array of structure ?? know easily

Home / C-Programming / what is Array of structure ?? know easily

in 

what is Array of structure ?? know easily


The ‘C’ programming language was developed in 1917 at Bell Laboratories by a system programmer named Dennis Ritchie.This C-language derived its name from the fact that it is based on a language developed by Ken Thompson, and other system programmer at Bell laboratory.
v Array of structure:-
The real power in using structure comes when use an array of structure.by maintain array of structure a database of information can may be wide range of items…..

/*Ex to illustrate array of structure*/



#include<stdio.h>
#include<conio.h>
struct student
{
int roll;
char name[15];
int sub1,sub2,sub3;
};
void main()
{struct student s[5];
int i;
clrscr();
for(i=0;i<5;i++)
{printf("\n enter roll no:");
scanf("%d",&s[i].roll);
fflush(stdin);
printf("\n enter name:");
gets(s[i].name);
printf("\n enter marks of 3 subject");
scanf("%d%d%d",&s[i].sub1,&s[i].sub2,&s[i].sub3);}
printf("\n enter details are:");
for(i=0;i<5;i++)
{printf("\n roll:%d,name:%s",s[i].roll,s[i].name);
printf("\n mark of subject1:%d",s[i].sub1);
printf("\n mark of subject2:%d",s[i].sub2);
printf("\n mark of subject3:%d",s[i].sub3);
}
getch();
}

DizIT_Operators
Thank-You 






No comments:

Post a Comment

Bottom Ad [Post Page]