Debug question

  • Thread starter Thread starter Guest
  • Start date Start date
timevalue[loopcountt] = duration;<<

Maybe loopcountt is greater than the size of the array
Try increasing the array size by one
Also check that variable should not be called loopcoun
and that it contains a reasonable value
 
Well, I just got rid of the array, timevalue, and wrote the values directly to my file. This method works fine, but I can't figure out why the other way didn't work. The variable, loopcountt, was spelled correctly and it wasn't at a value higher then the array size.
 
Hi Mike,

Mike said:
Well, I just got rid of the array, timevalue, and wrote the values
directly to my file. This method works fine, but I can't figure out why the
other way didn't work. The variable, loopcountt, was spelled correctly and
it wasn't at a value higher then the array size.

If it had a value equal to the size of the array than it was one too much as
C/C++ arrays are 0 based. I.e. if you have char c[1] the highest index is 0
not 1. So c[1] == 42 results in undefined behaviour.

Bye,
SvenC
 
I know about the index thing - loopcountt was initiated at zero
The program quit at the first instance of timevalue[loopcountt], that is at loopcountt = 0.
 
Back
Top