with the classes proton p[127] and phot light[127] set up above in the code and both of which containing perfectly working member functions. however, in this while loop it seems that when light[index].lAssignEnergy(index) runs it isn't recieving the final index integer (in the loop) correctly although for all others it works perfectly. the functions above it all recieve the correct value but lAssignEnergy messes up for the final, getting a completely random value of index, then immediately crashing the program. Help! The function lAssignEnergy is :