成都网站建设设计

将想法与焦点和您一起共享

数组逆置

#include

创新互联公司专注于罗甸网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供罗甸营销型网站建设,罗甸网站制作、罗甸网页设计、罗甸网站官网定制、成都微信小程序服务,打造罗甸网络公司原创品牌,更为您提供罗甸网站排名全网营销落地服务。

void fun(int a[], int n){

int i,j,temp;

for(i = 0,j = n-1; i < j; i ++,j --){//  交换时 i< j即可完成   

temp = a[i];

a[i] = a[j];//

a[j] = temp;

}

for(j = 0;j < n; j++){

printf("%d",a[j]);

}

}

int main(void){

int a[]  = {1,2,3,4,5,6,7,8,9};

    fun(a,9);

return 0;

}


网页名称:数组逆置
网页地址:http://chengdu.cdxwcx.cn/article/pgdpcc.html