编程交换数组a中首尾两个元素的位置

2025-03-24 21:20:33
推荐回答(1个)
回答1:

不知道你数组a是什么类型的,
定义一个临时变量temp,
temp=a[0];
a[0]=a[a.length];
a[a.length]=temp;