我正在编写一个程序来对双循环链表执行各种操作。所有其他功能都工作正常,但经过努力,我不知何故无法弄清楚为什么我的程序在执行 insert_end() 函数时会终止。功能是:
    void list::insert_end()
     {  int data;
         node*temp,*p;
         if(start==NULL)
        cout<<"CREATE list first!:"<<endl;
        else
        { cout<<"enter data to enter in a node after the last node:"<<endl;
          cin>>data;
          temp=new node(data);
          while(p->next!=start)
         { p=p->next;
         } // now p points to last node of doubly,circular list!! i.e. the linked list is traversed till p's next pointer points to start
           temp->pre=p;
          temp->next=p->next;
          p->next->pre=temp;
          p->next=temp;
          display();
        }
      }
它是一个菜单驱动程序。
请帮助我有关 insert_end 功能..我是初学者...