Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我遇到错误时,我应该寻找什么;运行时错误:在类型为';节点';(又名结构节点);? bool检查(常量字符*word) { node*node_ptr=第一个; for(int i=0,len=strlen(word);i是_word==true) 返回true; 其他的 返回false; } int index=get_index(单词[i]); if(node_ptr->children[index]==NULL) 返回false; node_ptr=node_ptr->children[索引]; } 返回false; }_C - Fatal编程技术网

当我遇到错误时,我应该寻找什么;运行时错误:在类型为';节点';(又名结构节点);? bool检查(常量字符*word) { node*node_ptr=第一个; for(int i=0,len=strlen(word);i是_word==true) 返回true; 其他的 返回false; } int index=get_index(单词[i]); if(node_ptr->children[index]==NULL) 返回false; node_ptr=node_ptr->children[索引]; } 返回false; }

当我遇到错误时,我应该寻找什么;运行时错误:在类型为';节点';(又名结构节点);? bool检查(常量字符*word) { node*node_ptr=第一个; for(int i=0,len=strlen(word);i是_word==true) 返回true; 其他的 返回false; } int index=get_index(单词[i]); if(node_ptr->children[index]==NULL) 返回false; node_ptr=node_ptr->children[索引]; } 返回false; },c,C,这是有问题的代码行,或者至少是错误消息指向我的代码行 我以前从来没有犯过这个错误,所以我很难处理它。 谷歌搜索也没有真正的帮助 这表示指针变量node_ptr为空,但您试图访问结构中预期位于内存位置的字段,但内存位置无效(指针未初始化为有效值)。您或者需要确保代码在处理过程中不会出现错误,导致它以空指针结束,或者需要通过将其设置为使用new(如果使用C++)或malloc(可以在C或C++中使用)分配给内存的内存,使其指向有效的内存位置。也不清楚变量“first”是什么…这可能是问题的一部分。。

这是有问题的代码行,或者至少是错误消息指向我的代码行

我以前从来没有犯过这个错误,所以我很难处理它。
谷歌搜索也没有真正的帮助

这表示指针变量node_ptr为空,但您试图访问结构中预期位于内存位置的字段,但内存位置无效(指针未初始化为有效值)。您或者需要确保代码在处理过程中不会出现错误,导致它以空指针结束,或者需要通过将其设置为使用new(如果使用C++)或malloc(可以在C或C++中使用)分配给内存的内存,使其指向有效的内存位置。也不清楚变量“first”是什么…这可能是问题的一部分。。。希望这有帮助

先发布
的定义
。更妙的是贴一张。
bool check(const char *word)
{


    node* node_ptr = first;
    for (int i = 0, len = strlen(word); i <= len; i++)
    {
        if(word[i] == '\0')
        {
            if (node_ptr->is_word == true)
            return true;
            else
            return false;
        }

        int index = get_index(word[i]);
        if (node_ptr->children[index] == NULL)
            return false;

        node_ptr = node_ptr->children[index];

    }
    return false;
}