Hi I would like some help on a programming problem, I'm new to all this and I'm new to the forum so I'll try my best to make this question easy to answer as possible.

I've done everything to get through this problem but I just don't know how to do it, basically the program question is:

"write a function to compute the average of a specified column of a 2-dimensional array that has NROWS rows and NCOLS columns. The parameters should be the integer array and the desired column. Assume that the corresponding function prototype is:

double col_ave(int x[NROWS, NCOLS], int col); "

well I've figured out how to find the average power output per week from a given data:

(power1.dat)

207 301 222 302 22 167 125

367 60 120 111 301 499 434

211 62 441 192 21 293 316

401 340 161 297 441 117 206

448 111 370 220 264 444 207

21 313 204 222 446 401 337

213 208 444 321 320 335 313

162 137 265 44 370 315 322

150 218 234 384 283 199 204

204 245 287 298 302 288 297

and this is the code I wrote below for that. However, the code ask for input so it was much easier to write. The problem I'm having is, how do I ask user to specify the column he/she wants to find the average of that involves arrays? how would I modify the code below to do this? I know this may not be easy to answer (I just only started to leanr programming for 3 weeks afterall), can someone at least give me a starting point? I mean I can ask user to input the column number he/she wants to find the average of but how do I specify the array of that column?

and what does it mean to "Assume that the corresponding function prototype is:

double col_ave(int x[NROWS, NCOLS], int col); " Thanks

insert
Code:

#include <stdio.h>
#include <stdlib.h>
#define NCOLS 7
#define NROWS 10
#define FILENAME "power1.dat"
int main(void)
{
/* Define variables. */
int i,j;
int power[NROWS][NCOLS], col_sum;
FILE *file_in;
/* Open input file. */
file_in = fopen(FILENAME,"r");
/* Display Error msg if file cannot open */
if (file_in == NULL)
printf ("Error, cannot locate file.\n");
else
/* Read data. */
{
for (i=0; i<=NROWS-1; i++)
for (j=0; j<=NCOLS-1; j++)
fscanf(file_in,"%d",&power[i][j]);
for (j=0; j<=NCOLS-1; j++)
{
col_sum = 0;
for(i=0; i<=NROWS-1; i++)
col_sum += power[i][j];
printf("Average power output in week %d is %.2f. \n", j+1,(double)col_sum/NROWS);
}
/* Close File */
fclose(file_in);
}
system("pause");
return 0;
}