int main() { int **a; int row, column; int count = 0; scanf("%d%d", &row, &column); a = (int **)malloc(row * sizeof(int *)); for (int i = 0; i < row; i++) { a[i] = (int *)malloc(column * sizeof(int)); } for (int y = 0; y < row; y++) { for (int x = 0; x < column; x++) { a[y][x] = count++; printf("%d ", a[y][x]); } printf("\n"); } }
原文:https://www.cnblogs.com/Ping697/p/14359019.html