I am hoping to compare two array and print two scores.
In the case below, should be 1 and 5 but I got 6488164 and 7536740. (as the first one only 7 is bigger than 4 and the next row is everything bigger)
Is it possible to compare a two-dimensional array with a single array and create an array with it? What did I do wrong or what should I do in order to do the comparison?
#include<stdio.h>
#include<stdlib.h>
int
main(int argc, char *argv[]) {
int mm_avg[2][5] = {{1,2,3,7,4},{2,3,4,5,7}};
int lt_avg[5]={1,2,3,4,5};
int i, j, score[100];
for (i=0; i<5; i++){
for (j=0; j<2; j++){
if(mm_avg[j][i]>lt_avg[i]){
score[j]++;
}
}
}
for (j=0; j<2; j++){
printf("%d\n", score[j]);
}
return 0;
}