【发布时间】:2011-11-12 06:07:13
【问题描述】:
我正在尝试编写一个接受数组作为参数的函数。但是,C 编译器 (lcc) 发出警告(即我的文件仍在编译)“.\tetris.c:179:警告:`clear_array' 的声明与 .\tetris.c:172 的先前声明不匹配” .
这是我的代码中涉及该函数的部分以及对该函数的调用,该函数引发了警告:
void remove_filled_rows ()
{
int row;
for (row = 0; row < NROWS; row++) {
// [snip]
if (col == NCOLS) {
clear_array (cells[row]); // line 172
}
}
}
/* Helper method that clears a row */
void clear_array (lc4uint row_array[]) { // line 179
int col;
for (col = 0; col < NCOLS; col++) {
row_array[col] = 0;
}
}
我的数组声明如下:
lc4uint cells[NROWS][NCOLS];
其中 NROWS 和 NCOLS 是整数常量,lc4uint 只是 unsigned int 的 typedef。
【问题讨论】: