【C语言】一维数组倒排
作者:互联网
#include <stdio.h> int main() { int arr[] = {1, 2, 3, 4, 5}; int i; int len = sizeof(arr) / sizeof(arr[0]); int mid = len / 2; for (i = 0; i < mid; i++) { int tmp = arr[i]; arr[i] = arr[4 - i]; arr[4 - i] = tmp; } for (i = 0; i < len; i++) printf("%d\n", arr[i]); return 0; }
标签:tmp,arr,倒排,int,mid,len,C语言,++,一维 来源: https://www.cnblogs.com/sdr900/p/16504210.html