相关疑难解决方法(0)

为什么NULL未声明?

我尝试编译此代码时遇到此结构构造函数的问题:

typedef struct Node
{
    Node( int data ) //
    {
        this->data = data;
        previous = NULL; // Compiler indicates here
        next = NULL;
    }

    int data;
    Node* previous;
    Node* next;
} NODE;
Run Code Online (Sandbox Code Playgroud)

当我来这个错误发生时:

\linkedlist\linkedlist.h||In constructor `Node::Node(int)':|
\linkedlist\linkedlist.h|9|error: `NULL' was not declared in this scope|
    ||=== Build finished: 1 errors, 0 warnings ===|
Run Code Online (Sandbox Code Playgroud)

最后一个问题是结构,但它在我的main.cpp中运行正常,这次是在头文件中并且给我这个问题.我正在使用Code :: Blocks来编译此代码

c++ syntax nodes

79
推荐指数
4
解决办法
17万
查看次数

标签 统计

c++ ×1

nodes ×1

syntax ×1