So I am writing a ternary tree and I get seg faults after maybe 20 insertions. When I isolate the problem in GDB I get a very odd error I have never seen before.
on the statement of code below, greater is another NODE and that node SHOULD be NULL (or another node) but when I am in GDB and I check its value I get *tempNode->0x4 this causes my code to attempt to set greater (0x4) as current node and results in a seg fault.
if( ! tempNode->greater )
else
{
tempNode = tempNode->greater;
}
Here is the GDB output: (gdb) p *tempNode->greater Cannot access memory at address 0x4
been stuck for hours, any ideas?