I'm having aproblem with my code, I would like to add another data up to 5 names with three grades each but I don't know how. This is my code

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

main()
{
unsigned char studname[30];
float prelim,midterm,final,average;
int total;

{
clrscr();
gotoxy(2,4);
printf("Please Enter Your Name: ");
gets(studname);

gotoxy(2,6);
printf("Prelim Grade: ");
gotoxy(19,6);
scanf("%f",&prelim);

gotoxy(2,8);
printf("Midterm Grade: ");
gotoxy(19,8);
scanf("%f",&midterm);

gotoxy(2,10);
printf("Final Grade: ");
gotoxy(19,10);
scanf("%f",&final);

total=prelim+midterm+final;
average=total/3;

gotoxy(2,12);
printf("Your Average is %f",average);
gotoxy(2,12);
scanf("%s",&studname);

getche();
}}

I'm not sure if I'm gonna use for loop or while. Any suggestions woud be of great help. Thanks

Firstly ...
please note that if you wish your code to be portable,
do not use <conio.h>

You can use a C struct and a typedef to create whatever data record you need.

typedef struct
{
    char* name;
    int id;
    int scores[5];

} Student;

And then in your main function ... get space to hold as many records as you need:

Student studs[100]; /* reserve space to hold 100 Student rec's */
commented: Thanks. +1