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')',是的,我无法弄清楚。帮助?
答案 0 :(得分:2)
push((&nodeeval), ((double)cur));
nodeeval
在这里是一种类型。传递指向top
的变量。
例如:
nodeval *top = 0;
push<nodeval>(top, ((double)cur));
push<nodeval>(top, ((double)pi));