for(I = 0; I<n/2; i++)
( 1)
About N/2:
Cycle from zero to a certain number, such as N= 15, which is 0-7;
0-8 if N= 16.
Why?
Because odd numbers are symmetrical about the middle: for example,15,8 is in the middle, 1-7 and both sides.
9- 15, 7 on both sides, 1 in the middle.
So there is no cycle in the middle, that is, there is no exchange in the middle 8, and both sides exchange.
Even numbers 16, 1-8, 9- 16 are all 8, so just exchange them directly.
{
(2)
t = a[I];
Assign the i th to t.
a[I]= a[N- 1-I];
Give the ith assignment a symmetric assignment.
a[N- 1-I]= t;
Then t (that is, the I th of the one that just gave me symmetry)
Completed the conversion.
}
(3)
On N- 1-i
For example, 15: because the first one is 0(i=0, so ai=a0), the one symmetrical with 0 is 14 (because it is 15, so it is the number 0- 14), that is, A0-a/kloc-0.
a[ 1] - a[ 13],a[2] - a[ 12],…………
Indeed
0 - 15- 1-0
1 - 15- 1- 1
2 - 15- 1-2
………………
That is, I am upside down with n-1-I.