Structure Arrya Example for multiple records


            struct Book
            {
              char name[20];
              int pages, rate;
            };
          
            main()
            {
              struct Book b[5];
              int k;
              clrscr();
          
              for(k = 0; k <= 2; k++)
              {
                printf("Enter the Book Name : ");
                scanf("%s", b[k].name);
          
                printf("\n Enter the Book Page : ");
                scanf("%d", &b[k].pages);
          
                printf("\n Enter the Rate of Book : ");
                scanf("%d", &b[k].rate);
              }
          
              printf("\t name \t pages \t rate");
          
              for(k = 0; k <= 2; k++)
              {
                printf("\n %s", b[k].name);
                printf("\t %d", b[k].pages);
                printf("\t %d", b[k].rate);
              }
              getch();
            }
          

Output: