|
|
> #while (J <= floor(N/2))
Actually, I think
#while (J < N/2)
is sufficient and even cleaner. If N is even, then the array has an odd
number of elements, and we don't need to swap the middle (N/2) element with
itself.
#macro Reverse_Array(Array)
#local J = 0;
#local N = dimension_size(Array, 1) - 1;
#while(J < N/2)
#local Temp = Array[J]
#local Array[J] = Array[N-J]
#local Array[N-J] = Temp
#local J = J + 1;
#end
#end
Anders
Post a reply to this message
|
|