I've created a code to calculate my class notes, it was working the first time, but after some runs, it shows:
[Error] variable-sized object may not be initialized
I don't know why! :(
CODE:
system("Color Fs");
float total = 0, moyenne;
int i,j, mawad = 11, ghanat = 3;
char * NAMES[] = {"Archi", "Dev", "EEJ", "ENG", "AR", "FR", "MATH", "RESEAU", "LINUX", "WIN", "TEC"};
float NOTES[mawad][ghanat] =
{
{20, 0, 0},
{20, 0, 0},
{10, 0, 0},
{10, 0, 0},
{10, 0, 0},
{10, 0, 0},
{15, 0, 0},
{35, 0, 0},
{30, 0, 0},
{30, 0, 0},
{10, 0, 0},
};
printf("------------------------------ LAY YSBR LGAMI3 ------------------------------\n");
for (i=0;i<mawad;i++){
printf("DGHL NO9TA DYAL %s", NAMES[i]);
for (j=0;j<2;j++) {
do {
printf("\t\tFRD %d:\n", j+1);
scanf("%f", &NOTES[i][j+1]);
} while (NOTES[i][j+1] > 20); // ILA DGHL KTR MN 20;
}
total += ((NOTES[i][1] + NOTES[i][2]) / 2) * NOTES[i][0];
}
moyenne = total / 200;
printf("\n\tMoyenne: %.3f \n", moyenne);