can someone help me debug this?
Code:
#include<stdio.h>
#define MONTH 12
#define YEAR 2
const char *month[]= {"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "Decenmber"};
int main() {
int a[][MONTH] = {367, 654, 545, 556, 565, 526, 437, 389, 689, 554, 526, 625,
429, 644, 586, 626, 652, 546, 449, 689, 597, 679, 696, 568};
int i, j, yeartotal;
double meanval;
printf("%-10s%-10s\n", "Year", "Mean hit");
printf("------------------\n");
for(j= 0; j < MONTH; j++) {
yeartotal= 0;
for(i= 0; i < YEAR; i++) {
yeartotal+= a[i][j];
}
meanval= (double)yeartotal/YEAR;
printf("%-10s %8.2f\n", year[i], meanval);
}
return 0;
}
this is the error message:
Code:
ERROR: argument 2 of the function is undefined or not a valid expression
ERROR: syntax error before or at line 25 in file C:\Users\Gabjew90\Desktop\hw7#10.c
==>: printf("%-10s %8.2f\n", year[i], meanval);
BUG: printf("%-10s %8.2f\n", year<== ???
ERROR: cannot execute command 'C:\Users\Gabjew90\Desktop\hw7#10.c'