我用C语言给二维数组随机赋值,为什么值会那么大
#include "stdlib.h"
#include "stdio.h"
#include "time.h"
#define M 3
#define N 10
void main( ){
int scores[N][M];
int i,j;
srand( (unsigned)time( NULL ) );
for(i=0;i<N;i++){
for(j=0;j<M;j++){
scores[i][j]=rand()%61+40;
printf("%d"" ",&scores[i][j]);
if((j+1)%3==0) printf("\n");
}}
}
int a[3][2]={ (0,1),(2,3),(4,5)}; 错了雀森碧 初始化时应该用{}来分组,改成: int a[3][2]={ {0,1},{2,3},{4,5}}; 你用小顷举括号,成了逗号运算,实际赋值结果春此为: int a[3][2]={ 1,3,5} ;