Hey guys. I am trying to display grade info for students, and I am getting a warning message that I am passing argument 1 of "FindMax" from incompatible pointer type.
In my code, I pass an array of pointers to the test_scores field, which I am hoping is equivalent to a 2D array (5 students with 4 test scores each). I may have the wrong idea though. Please let me know how I can approach this issue. I could try looping the call to the Max func, but I am curious if it is possible to call the Max func only once.
#include<stdlib.h>
#include<string.h>
#define MAX 100
struct StudentInfo{
char* name;
int* test_scores;
int highest;
float average;
char grade;
};
void InputData(char** Names, int** Scores);
int* FindMax(int** Scores);
float* FindAve(int** Scores, int* Max);
char* FindGrade(float* Ave);
void Table(char** Names, char** Scores, int* Max);
void Summary(char** Names, float* Ave, char* Grades);
int main(void){
struct StudentInfo* Class = (struct StudentInfo*)malloc(sizeof(struct StudentInfo*)*MAX);
for(i=0; i<MAX; i++){
Class[i]->name = (char*)malloc(sizeof(char)*MAX);
Class[i]->test_scores = (int*)malloc(sizeof(int)*MAX);
}
/* Initialization of Max Score, Ave Score, and Final Grade for each Student */
int* Max;
float* Ave;
char* Grade;
/* Calling below functions */
Max = FindMax(Class->test_scores);