“错误:在我的函数的第一行之前的预期表达式

时间:2013-04-13 19:28:26

标签: c expression

我在编译时遇到这个错误...“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;
 }      

1 个答案:

答案 0 :(得分:5)

它是sizeOf的首都O.您必须使用sizeof(小o)。