Need help with a strange for-loop problem
Hi,
I have a really really strange problem with a for loop. Let me show you my code first:
Code:
if(size == 2){
MessageBox(hwnd, "2", "size", MB_OK);
}
for(long c = 0; (c < size) && (flag); c++){
//loop body
}
if(!flag){
//there is a prompt
}
The strange thing here, is that my size is really 2, as the MessageBox will appear, but the for loop only runs one time, and the flag == false prompt does not show (i.e. the for loop isn't stopped by the flag). Even more strangely, if I hard code (c < 2) instead of (c < size), then it works very fine.
Anyone knows what's the problem? By the way I'm using Dev-C++ 4.
Thanks in advance.
EDIT: Does it help if I tell that my whole project consists of >1300 lines? Does it matter?