I have a variable which keeps changing for no reason.
I watched the variable with my debugger and in this code here -
at treenNodes++ it goes from 0 to 1, which is right.Code:tree->nNodes++; tree->nodes = (TREENODESTRUCT*)realloc( tree->nodes, sizeof( TREENODESTRUCT ) * tree->nNodes ); tree->nodes[tree->nNodes-1] = *(TREENODESTRUCT*)lParam;
When it hits the last line it changes to some seemingly random number, like what you get before initializing the variable. I commented out the last line and it stays at 0, of course I also get a segfault because there is no info in the struct which I would be filling with the data in the lParam cast.