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