Check here
Code:
array[i]=(int**)malloc(NUMBER_OF_CLASSES*sizeof(int*));{
        for (j=0;i<NUMBER_OF_GRADES;j++)
Change that to this
Code:
 array[i]=malloc(NUMBER_OF_CLASSES*sizeof(int*));
 
        for (j=0;j<NUMBER_OF_CLASSES;j++)
        {
The Indent style would tell you the truth by itself