#define countof(c) sizeof(c) / (sizeof(*(c)))
unsigned int i;
unsigned int temp;
unsigned int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
for (i = 0; i < (countof(arr) / 2); i++) {
temp = arr[i];
arr[i] = arr[countof(arr)- i - 1];
arr[countof(arr) - i - 1] = temp;
}
//如果有奇数个元素,那么countof(arr) / 2 取整。比如说有11个元素,那么countof(arr) / 2 的值为5.
|