I am trying to delete a node in a linked list, and I get a seg fault like this:
Code:
Program received signal SIGSEGV, Segmentation fault.
0x0804da34 in SCLLRep::Merge (this=0x82499a0, set2=0x82499f0) at SCLL.cpp:187
187 delete set2_NodeToDelete;
(gdb)
Declared like this:
Code:
SCLLNode* set2_NodeToDelete = new SCLLNode();
set2_NodeToDelete = set2->Getptr2last()->Getnextnode();
(Tried without the new keyword too)
-----
What could be a possible problem that would cause this to result in a seg fault?
The thing that confuses me is that it doesn't even execute anything. I just say "delete variable" and BAM, seg fault.