在函数调用中预期的primary-expression befor')'

时间:2015-07-29 06:57:10

标签: c++

struct nodeeval {       //node definition for post fix expression evaluation
    double data;
    nodeeval * next;
};


void push(T* &  top, T item) {
    T * p;
    p = new T;
    if (p!=NULL) {
        p->data = item;
        p->next = top;
        top = p;
    }
}
push((&nodeeval), ((double)cur));

此代码生成错误(预期的primary-expression befor')',是的,我无法弄清楚。帮助?

1 个答案:

答案 0 :(得分:2)

push((&nodeeval), ((double)cur));

nodeeval在这里是一种类型。传递指向top的变量。

例如:

nodeval *top = 0;
push<nodeval>(top, ((double)cur));
push<nodeval>(top, ((double)pi));