dlang的dmd 2103版本静态数组怎么实现反转
可以使用std.algorithm.reverse函数来实现静态数组的反转,例如:
import std.algorithm;
void main()
{
int[] arr = [1, 2, 3, 4, 5];
reverse(arr);
foreach (e; arr)
writeln(e);
}
输出结果为:
5
4
3
2
1
原文地址: https://www.cveoy.top/t/topic/e8Ls 著作权归作者所有。请勿转载和采集!