我在编译时遇到这个错误...“stock.c:103:错误:在'stock_t'之前的预期表达式”...是否有一些我做错了?
stock_t * createStockHolding(
char * name, float closing, float opening, int shares,
float (* getPrice) (void * S),
float (* getTotalDollarAmount)(void * S),
float (* getPercentChange)(void * S),
char * (* toString)( void * S)) {
stock_t * newStock = (stock_t*)malloc(sizeOf(stock_t));
newStock->stockSymbol = name;
newStock->closingSharePrice = closing;
newStock->openingSharePrice = opening;
newStock->numberOfShares = shares;
newStock->getPrice = getPrice;
newStock->getTotalDollarAmount = getTotalDollarAmount;
newStock->getPercentChange = getPercentChange;
newStock->toString = toString;
return newStock;
}
答案 0 :(得分:5)
它是sizeOf
的首都O.您必须使用sizeof
(小o
)。