November 16th, 2008, 03:18 AM
programm only working in debug?!
I'm writing a win console program that creates 100 binary search trees, each consisting of 500 nodes that each hold an integer between 0 and 500.
The trees are getting their 500 integers from an instance of a class intlist, a list that holds the integers 0..500 in a random order.
i'm using pointers to create instances of the trees, cuz i tried using an array, but for some reason the program ended up adding the new nodes to the existing tree... that was solved by using pointers, though.
the remaining problem is: it crashes after created 3 or 4 trees! okay, so i have a faulty program, big deal.. I debugged, works fine!
every time i debug, it works fine, and when i'm not debugging, it crashes.
i'm using dev-cpp under windows vista.
here's the code for my main:
Can anyone tell me what's going on here? this is rather frustrating.. :P
const int TREE_AMOUNT = 100;
void filltree(intlist mylist, bst & mytree, int a)
int c = 0;
for(c; c <= NODE_AMOUNT; c++)
// cout << a << " ";
cout << "Tree created! Internal Path Length: " << mytree.ipl << endl;
int a = 0,c=0;
for(a; a<=TREE_AMOUNT; a++)
mylist = new intlist;
mytree = new bst;
filltree((*mylist), (*mytree), a);
cin >> a;
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!