我有以下法典部分:
typedef struct Board* BoardP;
typedef struct Board {
int _rows;
int _cols;
char *_board;
} Board;
char* static allocateBoard(BoardP boardP, int row, int col) {
boardP->_rows = row;
boardP->_cols = col;
boardP->_board = malloc(row * col * sizeof(char));
return boardP->_board;
}
i can t seem to figure out why it gives the error expected identifier or ‘(’ before ‘static’ it gives the error after i changed return type to be char*. when it was void no error was given.
还有一个问题: i 教授的是,在使用小型电池时需要投放,但似乎在没有 cast子的情况下工作。 在这种情况下需要吗?
感谢