C++数组反转源码

106 阅读1分钟

把开发过程比较重要的一些内容段收藏起来,下边内容内容是关于C++数组反转的内容。

#include <stdio.h>

{
}

void reverse(int a[],int n)
{
    static int c = 0;
    if(c<n/2)
    {
        xchg(&a[c],&a[n-c-1]);
        ++c;
        reverse(a,n);
    }
}

void show(int a[],int n)
{
    int i;
    for(i=0;i<n;i++)
    {
    }
}

int main()
{
    int a[]={1,2,4,5,3,6};
    reverse(a,6);
    show(a,6);
    return 0;
}