声明C函数以返回数组
const int WIDTH=11;const int HEIGHT=11;int main() { char A[WIDTH][HEIGHT]; A=rand_grid(WIDTH,HEIGHT); return 0;}// Initializes a random board.char[][] rand_grid(int i, int k) { char* A[i][k]; for(j=0;j<i;++j) { for(l=0;l<k;++l) { A[j][l]=ran(10); } } return A;}// Returns a random number from the set {0,...,9}.int ran(int i) { srand((unsigned int) time(0)); return(rand()%10);}
喵喵时光机
守着星空守着你
相关分类