Reputation: 1
I am a beginner in c programming. I am trying to reference the following functions in an array function pointer as shown in processGrades 4 element array. I am having trouble getting the grades array 3 x 4 to pass through to the functions. I am trying to use pointers but I do not seem to be formating the pointer properly. I would appreciate help or a reference to help understand how to do this. My reference is very basic.
void minimum(int grades[][EXAMS], size_t pupils, size_t tests);
void maximum(int grades[][EXAMS], size_t pupils, size_t tests);
void average(int grades[][EXAMS], size_t pupils, size_t tests);
void printArray(int grades[][EXAMS], size_t pupils, size_t tests);
void(*processGrades[4])(int, size_t, size_t) = { printArray, minimum, maximum, average };
Upvotes: 0
Views: 61
Reputation: 741
Try this
typedef void (*processGrades)(int[][MAX], size_t, size_t);
Upvotes: 1
Reputation: 1742
The first argument type of the pointer is incorrect. You should change int
to int[][EXAMS]
.
Upvotes: 3