0

Hi i'm in a university class, and i'm working on a little assignment that is supposed to have an int array and have assorted functions to do things to the array currently i have two of the four functions working and i'm having trouble with the function that is supposed to find the min value and the one that finds the max, once you solve one you most likely solve the other thank you.

```
#include <stdio.h>
#include <stdlib.h>
#define STUDENTS 3
#define EXAMS 4
#define MIN_NUM 999999999999
int printArray(int *arry1,int n, int k);
int findMin(int *arry1,int n, int k);
int findAVG(int *arry1,int n, int k);
int (*ptr1)(int *,int,int);
int (*ptr2)(int *,int,int);
int (*ptr4)(int *,int,int);
int main(){
int studentGrades[STUDENTS][EXAMS]= {{ 77 , 68 , 86 , 73 },{ 96 , 87 , 89 , 78 },{ 70 , 90 , 86 , 81 } } ;
ptr1 = &printArray;
ptr2 = &findMin;
ptr4 = &findAVG;
int choice;
printf("Enter in a value to select the following options from the menu\n0-Print the array of grades\n1-Find the minimum grade\n2-Find the maximum grade\n3-Print the average on all tests for each student\n4-End program\n");
scanf("%d", &choice);
if(choice == 0){
ptr1(*studentGrades,STUDENTS,EXAMS);
}
else if(choice == 1){
ptr2(*studentGrades,STUDENTS,EXAMS);
}
else if(choice == 2){
}
else if(choice == 3){
ptr4(*studentGrades,STUDENTS,EXAMS);
}
else if(choice == 4){
exit(1);
}
}
int printArray(int* array, int num_rows, int num_cols)
{
int i, j;
for (i=0; i < num_rows; i++)
{
for(j=0; j < num_cols; j++)
printf("%d ", *(array + (num_rows * i) + j));
printf("\n");
}
return 0;
}
int findMin(int* array, int num_rows, int num_cols){
int min = MIN_NUM;
for(int i = 0; i < num_rows; i++){
for(int j = 0; j < num_cols; j++){
if(min < *(array + (num_rows * i) + j))
min = *(array + (num_rows * i) + j);
}
}
return 0;
printf("The minimum grade in the array is %d", min);
}
/*
void findMax(char *arry1[][], int n, int k){
int max = arry1[0][0];
for(int i = 0; i < n; i++){
for(int j = 0; j < k; j++){
if(max < arry1[i][j])
max = arry1[i][j];
}
}
printf("The maximum grade in the array is %d", max);
}
*/
int findAVG(int* array, int num_rows, int num_cols){
int avg, temp = 0;
for(int i = 0; i < num_rows; i++){
for(int j = 0; j < num_cols; j++){
temp = temp + *(array + (num_rows * i) + j);
}
}
avg = temp / (num_rows * num_cols);
printf("The average grade in the array is %d", avg);
return 0;
}
```