Delta_G:
I think what you were going for was the classic "count the number of elements" code which is more like:float MomentumOfParticles[sizeof (MassOfparticle) / sizeof (MassOfparticle[0])];EDIT: ***Actually 20 because MassOfParticle is an array of int not float.
Although slightly clunky, what I posted does produce the correct result so maybe the compiler does do some magic there, I don't know.
I was not aware of the 'classic' technique. That's pretty nifty! Thanks! Now I've got to do some more editing.
From OP's inital post:
float MassOfparticle[i] = {1,2,3,4,5,6,7,8,9,10};