数组问题
# include <stdio.h># define A 8
# define B 12
# define C 0//C的赋值和D的赋值,决定于要算从C到D之间的数组数!例如C=0,和D=7就是算8组数组的列之和!
# define D 7
int main(void)
{
int i, j ,total;
int arry[A][B] = {
{3,1,0,0,0,1,0,0,0,0,2,0},
{0,0,0,0,1,1,0,0,0,3,1,1},// 2 2 0 1 3 1 3 2 1 5 3 5
{0,0,0,0,0,0,3,0,0,1,1,2},
{0,1,0,1,2,0,0,1,0,1,1,0},
{2,1,0,0,0,0,0,1,1,0,0,2},
{1,1,0,1,0,1,1,0,1,1,0,0},
{1,0,0,1,0,1,1,1,1,0,0,1},
{1,0,0,0,3,0,1,0,1,0,1,0}
};
for(j = 0; j < B; ++j)
{
total = 0;
for(i = C; i <= D; ++i)
{
total += arry[i][j];
}
printf("%3d", total);
}
putchar('\n');
return 0;
}
//输出结果:
8 4 0 3 6 4 6 3 4 6 6 6!
这俨然是个数组!怎么把这结果赋给数组,就是组成新的数组!并且能输出和运算!