错误:','令牌之前的预期表达式

时间:2016-04-21 18:35:54

标签: c

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

    struct nodes
    {
        char* info;
        struct nodes * left;
        struct nodes * right;

    };

    char* question = "any question?";
    struct nodes * node = NULL;
    struct nodes * nodeleft = NULL;
    struct nodes * noderight = NULL;

    struct nodes newNode (char info[50], struct nodes * l, struct nodes * r)        `       {
        struct nodes conf;
        conf.info = info;
        conf.left = l;
        conf.right = r;
        return conf;
    }

这里我试图创建一个左,右节点为空的新根节点

    int main(){
        node = newNode (question, nodoleft*, nodoright*);

        return 0;
    }

不知道为什么我在尝试创建新节点时遇到此错误...我是C的新手     错误:错误:','标记

之前的预期表达式

1 个答案:

答案 0 :(得分:1)

"nodoleft*,""nodoright*"中,您看起来好像已经开始乘法,然后在没有第二个操作数的情况下离开。无论如何,每个参数都应该是一个表达式。在此上下文中,变量名称确实符合表达式。所以,如果你只是

node = newNode (question, nodeleft, noderight);

你的编译器可能会更开心。

相关问题