我正在編譯時遇到此錯誤...「stock.c:103:錯誤:'stock_t'之前的期望表達式」...是否有一些我做錯了什麼?「Error:expected expression before」我的函數的第一行
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;
}
而你包含頭文件'stock_t'聲明? –
具有多於5個參數的功能通常意味着存在設計問題。 – ouah
你能否在這段代碼上面粘貼一些行,錯誤可能在其中之一。 – Kninnug