I have a runtime error which writes more data from an array than its suppose to print ID, AverageMarks and Status:
Declaration & Its Function
char StudentStatus[10][7];
for(x=0;x<10;x++)
{
fprintf(OutputFile,"%d\t\t%d\t\t\t%s\n",StudentID[x],StudentAvg[x],StudentStatus[x]);
}
But when it prints
100 77 DismissActive
101 85 Active
102 88 Active
103 86 Active
104 85 Active
105 84 Active
106 84 Active
107 82 Active
108 92 Active
109 75 Dismiss
The way the array was filled:
for(x=0;x<NumOfStudent;x++)
{
if(StudentAvg[x]>80)
{
strcpy(StudentStatus[x],"Active");
printf(". ");
}
else
{
strcpy(StudentStatus[x],"Dismiss");
printf(". ");
}
}
Other statements works fine but the first statement really troubles me. Any suggestion where I code wrongly?