用include<stdio.h
时间: 2023-07-19 17:14:54 浏览: 55
# include <stdio.h>
可以使用 include<stdio.h> 中的 printf 函数输出结果,具体实现如下:
```c
#include <stdio.h>
void reverse(int arr[], int n) {
int left = 0, right = n - 1;
while (left < right) {
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
int main() {
int arr[] = {8, 6, 5, 4, 1};
int n = sizeof(arr) / sizeof(arr[0]);
reverse(arr, n);
for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
printf("\n");
return 0;
}
```
输出结果为:
```
1 4 5 6 8
```
阅读全文