我不断收到分段错误:
#define MATRIX_SIZE 50
void fill_matrix(char *pointer[], char c) {
int i, j;
for (i = 0; i < MATRIX_SIZE; i++) {
for (j = 0; j < MATRIX_SIZE; j++) {
// tried many syntaxes
// *(*(pointer + i) + j) = c;
// *(pointer + i)[j] = c;
// pointer[i][j] = c;
}
}
}
int main(int argc, char *argv[]) {
char matrix[MATRIX_SIZE][MATRIX_SIZE];
fill_matrix(&matrix, ' ');
}
辅助方法应该如何访问二维数组?指针让我感到困惑!