0

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 };

2 Answers 2

3

The first argument type of the pointer is incorrect. You should change int to int[][EXAMS].

Sign up to request clarification or add additional context in comments.

Comments

1

Try this

typedef void (*processGrades)(int[][MAX], size_t, size_t);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.