int arr[] = {2,34,4,55,43,6,7,8,100}; for (int i = 0; i < sizeof(arr) / sizeof(arr[0]) / 2; ++i) { int temp = arr[i]; arr[i] = arr[sizeof(arr)/sizeof(arr[0]) - 1 - i]; arr[sizeof(arr) / sizeof(arr[0]) - 1 - i] = temp; } for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); ++i) { printf("arr[%d] = %d\n", i, arr[i]); }
原文:https://www.cnblogs.com/mayichen0823/p/10162071.html