rxu*_*rxu -4 c++ for-loop range
是否可以使用/实现一个远程基本循环来为数组分配数字?
我想要的是:
for (auto i : X){
i = 1;
} //I want this to fill the array with 1.
Run Code Online (Sandbox Code Playgroud)
是否可以使用/实现一个远程基本循环来为数组分配数字?
是的,使用参考:
for (auto & i : X){
// ^
i = 1;
}
Run Code Online (Sandbox Code Playgroud)