Saturday, 11 February 2012

Program Of Array Of String In C


#include<stdio.h>
#include<conio.h>

          struct student         // Structure Delaration
{
int rollno;
char name[20];
int marks;

} ;
main()
{
int i;
clrscr();
student s1[3];       // Object(s1[]) Array  of  Structure  is Declare
for(i=0;i<3;i++)
{
printf("Enter rollno=");
scanf("%d",&s1[i].rollno);     // Access of  Structure
printf("Enter Name=");
scanf("%s",s1[i].name);
printf("Enter MArks=");
scanf("%d",&s1[i].marks);
}
printf("\n==============  REcord of Student================\n");
for(i=0;i<3;i++)
{

printf("\n Roll Number= %d",s1[i].rollno);
printf("\n Name= %s",s1[i].name);
}
getch();
}

No comments:

Post a Comment