Now i begin to understand:
You start your program with the debugger and it works as expected, but if you start your program without debugger it fails?
I can reproduce this. It is not a fault of the debugger, but this happens if you don't initialize a variable, like here:
int a[100],b[100],z[100],i,s,F,w,x;
all this variables have random values. It is possible that the debugger runs on a zeroed ram segment, and all your variables are initialized with zero, but in release mode your program runs on a random filled ram segment, so your variables are filled with random values. This leads to errors like you are receiving.
This has nothing to do with codeblocks or the debugger, but with clean programming...
The solution would be to clean up your code...
codeblocks per se does not go wrong, because codeblocks is not a compiler and for this it has nothing to do with your code / your compiled program...
I don't think that in so simple code a compiler bug triggers so i think your code is wrong on one point... I made a quick look, but i didn't find anything critical (beside that you are not deleting Q after a new call)... One thing i can think of is, that cin reads some garbage from the input buffer...
you can try cpp check to analyze your code: http://cppcheck.sourceforge.net/
i have to admit, that your code is not easy to read and to understand...
void creat(List &T,int e) //build the tree
{
if(!T)
{
LNode *S;
S=new LNode;
S->data=e;
S->lchild=S->rchild=NULL;
T=S;
}
else if(e>T->data)creat(T->rchild,e);
else if(e<T->data)creat(T->lchild,e);
}
You assign T a new allocated List, but what happens with the old List??? This is for example a memory leak you should avoid. And i think the whole code is full with this... If your code works, it is luck or tolerance of your OS or compiler, but at one point it will blow up... The consequence is (or better can be) that your program works under debug mode but not in release...
sry i can't help more, but this is now out of the scope of this forum, as you don't have a problem with codeblocks, but with the underlying compiler...