dougp:
That makes sense. What is the cause then of "error: size of array 'momentumOfparticles' has non-integral type 'float'" ?
You missed part of the message:
"error: size of array 'momentumOfparticles' has non-integral type 'float [i]'"
It's not saying that the index is a 'float'. It's saying that the index is an array of floats of size 'i'. That array is not an integer.