Pages

Adsense responsive

Friday, 8 March 2013

EXAMPLE OF ARRAY OF STRUCTURE IN C PROGRAMMING

CODING:
#include<conio.h>
#include<stdio.h>
struct stud_record
{
 char name[25];
 char cls[5];
 int roll_no;
};
main()
{
 int i;
 struct stud_record student[2];
 clrscr();
 for(i=0;i<2;i++)
 {
  printf("Enter name: ");
  scanf("%s",student[i].name);
  printf("Enter class: ");
  scanf("%s",student[i].cls);
  printf("Enter roll no.: ");
  scanf("%d",&student[i].roll_no);
  printf("\n");
 }
 printf("\n\n");
 for(i=0;i<2;i++)
 {
  printf("RECORD %d\n",i+1);
  printf("Name: %s\n",student[i].name);
  printf("Class: %s\n",student[i].cls);
  printf("Roll no. %d\n\n",student[i].roll_no);
 }
 getch();
}

CODING


OUTPUT


For any query or suggestion please comment below...

No comments:

Post a Comment