# include & lt; Stdio. H>
# define STUD 30
5 # define COURSE
Void Total (int * score, int sum [], float aver [], int m, int n);
Void Print (int * score, int sum [], float aver [], int m, int n);
Int main (void)
{
Int I, j, m, n, score [STUD] [running], the sum (STUD); Float aver [STUD];
Printf (" How many courses? \n"); The scanf (" % d ", & amp; n);
Printf (" How many students? \n"); The scanf (" % d ", & amp; m);
Printf (" Input scores: \ n ");
for(i=0; i
for(j=0; j
}
}
The sum Total (* score, aver, m, n); Print (* score, sum, aver, m, n);
return 0; }
PScore void Total (int * and an int sum [], float aver [], int m, int n)
{
int i,j;
for(i=0; i
for(j=0; j
Sum [I]=sum pScore [I] + [I * n + j];
}
Aver [I]=sum (float) [I]/n;
}
}
PScore void Print (int * and an int sum [], float aver [], int m, int n)
{
int i,j;
Printf (" Result: \ n ");
for(i=0; i
for(j=0; j
Printf (" % 4 d \ t, "pScore [I * n + j]);
} printf (" % 5 d \ t % 6.1 lf \ n ", sum [I], aver [I]);
}
}
CodePudding user response:
The problem here:Score [STUD] [running]
So
for(j=0; j
Sum [I]=sum pScore [I] + [I * n + j];
}
Is wrong
Sum [I]=sum pScore [I] + [I * COURSE + j];
Such ability can
The following Print function is the same problem
CodePudding user response:
Column a pointer is an array of the number of columns for each of the mobile, the original array line corresponding row pointer course is several times? The memory of those empty array is emptyThe book says column pointer is equivalent to the two dimensional array as a one-dimensional array
According to this problem is a string of number in discontinuous luo
CodePudding user response:
Int a [2] [3]={6};A [0]=={1, 2, 3} [0] a [0]==1 a [0] [1]==2 a [0] [2]==3
A [1]=={4 and 6} [1] a [0]==4 a [1] [1]==5 a [1] [2]==6
Two-dimensional array like excel spreadsheet, with two rows and columns to determine the specific position,
CodePudding user response: