小编Leo*_*oso的帖子

C++ 以逆序访问数组

我有下面的代码

int array[3] = { 10, 15, 20};
Run Code Online (Sandbox Code Playgroud)

如何以相反的顺序访问其元素,而不反转索引。我的意思是索引0将返回最后一个元素(20),索引2将返回第一个元素(10)。

array[0] // it would return 20
Run Code Online (Sandbox Code Playgroud)

提前致谢

c++ arrays

-3
推荐指数
1
解决办法
459
查看次数

标签 统计

arrays ×1

c++ ×1