Error when indexing into array

Hello,

I assume this is simple to fix but I cannot get there. The expression:

crd[(int)time/dtime][i]

i is of type int and both time and dtime are of type real. The array crd is a 2D array of doubles. This gives the error: error C2108: subscript is not of integral type

I also tried this expression:

crd[int (time/dtime)][i]

this gives the error: error C2059: syntax error: 'type'

How do I get the correct index into the array??

Thanks!
Last edited on
If you are using C then you need to say crd[(int)(time/dtime)][i]
That did it! Thanks!
Topic archived. No new replies allowed.