# Thread: eXtremely strange problem with amount indicator

1. ## eXtremely strange problem with amount indicator

Look at this section of code:
Before calling this, the varible quads is 50.
Code:
```   // Copy the wings to the other side now:
for(x = 0, bWingsOut = FALSE; x < quads; x++) {
if(quadEx[x] == XL_WING) bWingsOut = TRUE;
if(bWingsOut) {
if(quadEx[x] == XL_END) bWingsOut = FALSE;
for(y = 0; y < 7; y++)
After I call this, quads becomes 3. Why?? I only alter quads for the greater once!
The weird thing is, when I comment out THIS LINE, quads is what it's suppose to be. 2. This is really strange; changing the code to
Code:
```   // Copy the wings to the other side now:
for(x = 0, bWingsOut = FALSE; x < quads; x++) {
if(quadEx[x] == XL_WING) bWingsOut = TRUE;
if(bWingsOut) {
if(quadEx[x] == XL_END) bWingsOut = FALSE;
for(y = 0; y < 7; y++)
works.
If anyone knows why it's doing this I would still like to know! 3. Buffer overflow perhaps? Where is quadEx declared, and is its size at least 51? 4. Have you stepped through it to see it change there? I see no reason why the value of quads should change to 3.... 5. Indeed. Have you tried printing quad's value for each iteration and seeing it change? Or does 'x<quads' only run once?

Is quad your own type? If so how do you pass into the [] operator? Reference? Do you change it? 6. This loop only runs once durring init.

I have already thought of buffer overflow, but as you can see my decs don't indicate anything of the sort.
Code:
```#define XL_VECTOR   0
#define XL_END      1
#define XL_WING     2 Popular pages Recent additions 