C++ 指针的问题?访问冲突读取位置0xfeeeff0e

C++ 指针的问题?访问冲突读取位置0xfeeeff0e,c++,C++,我正在尝试为我的数据结构类创建一个使用链表的反向波兰符号计算器,但我似乎无法解决这个问题。根据我对VS2010的业余解读(以及其他相关帖子),我很可能得到了一些时髦的指针(悬空,未声明?)。我不能从其他报道同样错误的帖子中得出结论 精确调试输出: Unhandled exception at 0x00a42504 in Assignment 1.exe: 0xC0000005: Access violation reading location 0xfeeeff0e. 以下是供参考的节点类:

我正在尝试为我的数据结构类创建一个使用链表的反向波兰符号计算器,但我似乎无法解决这个问题。根据我对VS2010的业余解读(以及其他相关帖子),我很可能得到了一些时髦的指针(悬空,未声明?)。我不能从其他报道同样错误的帖子中得出结论

精确调试输出:

Unhandled exception at 0x00a42504 in Assignment 1.exe: 0xC0000005: Access violation reading location 0xfeeeff0e.
以下是供参考的节点类:

class Node
{
    public:
    string optype_orVal; 
    int id;
    double num;
    Node *next;

Node(string input, Node *ptr=0)
{
    next = ptr;
    optype_orVal = input;

    if (input == "+" || input == "-" || input == "*" || input == "/")
        id = 0;
    else
    {
        num = atof(input.c_str());
        id = 1;
    }
}
我正在使用
int id
作为我的
polishCalc()
方法查看节点是否包含运算符或操作数的快速方法。在
if(temp->id==0)
是VS调试器查找错误的地方。我尝试过在for循环中调整声明,但没有成功。注意这只是
polishCalc()
方法的一部分,并且
操作数[]
是私有实例化的

string polishCalc()
{
    Node* temp;
    Node* hold;
    int i;
    int holdcounter;

    for (temp = hold = top, i = holdcounter = 0; i < 2 || temp != 0; temp = temp->next)
    {
        ++holdcounter;
        if (holdcounter > 2)
            hold = hold->next;
        if ( temp->id == 1)
        {
            operands[i] = temp->num;
            ++i;
            --count;
            if (top == temp)
            {
                    top = temp->next;
                    delete temp;
            }
                else
                {
                    hold->next = temp->next;
                    delete temp;
                }
        }

    }
string polishCalc()
{
节点*温度;
节点*保持;
int i;
int保持计数器;
对于(temp=hold=top,i=holdcounter=0;i<2 | | temp!=0;temp=temp->next)
{
++等待计数器;
如果(保持计数器>2)
保持=保持->下一步;
如果(临时->id==1)
{
操作数[i]=temp->num;
++一,;
--计数;
如果(顶部==温度)
{
顶部=温度->下一步;
删除临时文件;
}
其他的
{
按住->下一步=临时->下一步;
删除临时文件;
}
}
}

任何帮助都将不胜感激,谢谢!

如果你做了
delete temp;
那么你的
temp=temp->next
不会爆炸吗?0xfeeefeee是一个神奇的值,它意味着你正在使用释放的内存。使用
delete temp;
然后
temp=temp->next
肯定会很糟糕。我可以重新分配temp to另一个节点。当我删除temp时,我删除的是temp表示的节点,而不是temp构造。我的教授就是这样设置他的析构函数的,它符合/运行良好。