   Vector help
  Probably a easy question but here it goes. Why does this always bring me to an instant crasch?Vector<float> myX;Vector<float> myZ;//insert data into vectors...//Crash when reading like this:float test = myX[myZ[4]];   
  Use .at() instead of []float test = myX.at(myZ.at(4));Won't stop the crash but will likely give you an out of bounds access error.   ;  AND I just realized you're trying to index into an array with a float index. That won't work.   ;Quote:Original post by RabidDogAND I just realized you're trying to index into an array with a float index. That won't work.It'll work, but it's probably a bad idea to try and do it.As for the actual problem, either myZ doesn't have 4 elements in it, or myX doesn't have whatever myZ[4] is elements in it.   ;Quote:Original post by Evil SteveQuote:Original post by RabidDogAND I just realized you're trying to index into an array with a float index. That won't work.It'll work, but it's probably a bad idea to try and do it.As for the actual problem, either myZ doesn't have 4 elements in it, or myX doesn't have whatever myZ[4] is elements in it.Spot on.Apparently my for loop did not fill the vectors correctly.Thanks a bunch.   