diff --git a/万维调考试题源码/4-2.c b/万维调考试题源码/4-2.c index 3485462..10ae444 100644 --- a/万维调考试题源码/4-2.c +++ b/万维调考试题源码/4-2.c @@ -31,6 +31,14 @@ void sort(int *p, int n) { int i, j, temp; /**********Program**********/ - + i = 0; + j = n-1; + while(i < j){ + temp = p[i]; + p[i] = p[j]; + p[j] = temp; + i++; + j--; + } /********** End **********/ -} \ No newline at end of file +}