检查空指针失败

时间:2014-10-24 05:26:05

标签: c++

披露,这是为家庭作业。

我正在使用与此处找到的哈希表非常相似的哈希表:http://www.algolist.net/Data_structures/Hash_table/Simple_example

当我在表中插入一个元素时,会检查以确保当前数组元素不为null,如下所示:

    while (table[hash] != NULL && table[hash]->status != DELETED)
    hash = (hash + 1) % tablesize;

无论出于何种原因,当程序崩溃时,这似乎并不能保护指针。调试器显示表的以下内容:

-       table   0x004892d8 {0xcdcdcdcd {status=??? key=??? e={...} }}   HashElement<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > * *

我不知道这意味着什么:|

0 个答案:

没有答案
相关问题