This is the problem statement for this assignment:
As warm-up, write a program that displays the sum and average of both the rows and columns of a
rectangular double array named table. Do not use a global: declare table in main. Define table’s
dimensions statically using the preprocessor, defaulting to 5 × 3. Your solution must include three
functions: readTable, sumAveRow, and sumAveColumns.
I suggest this signature for sumAveRow: sumAveRow(int r, double t[][COLS], double* sum, double*
average).
here is my code so far:
I know it's not complete, but my real concern is that I keep getting syntax errors in the function calls for readTable and sumAveRow:Code:#include <stdio.h> #define COLS 3 #define ROWS 5 void sumAveRow(int r, double t[][COLS], double* sum, double* average); void sumAveCol(int c, double t[][COLS], double* sum, double* average); void readTable(int r, int c, double t[][COLS]); int main() { double table[ROWS][COLS]; double sum, average; /* get inputs and store in table */ readTable(ROWS, COLS, table[][COLS]); sumAveRow(ROWS, table[], &sum, &average); return (0); } void readTable(int r, int c, double t[][COLS]) { int i = 0; int j = 0; double data = 0; while ( i > ROWS) { printf("For row %d,", i); while ( j < COLS ) { printf(" enter a double: "); scanf("%lf", &data); t[i][j] = data; j = j + 1; } i = i + 1; j = 0; } } void sumAveRow(int r, double t[][COLS], double* sum, double* average) { int i = 0; int j = 0; sum = 0; average = 0; for (i = 0; i < r; i++) { *sum = t[i][j]; } *average = (*sum / r); printf("Row %d: Sum = %.2lf; Average = %.2lf", i, *sum, *average); }
error: syntax error before ']' token. What can I do to fix this?