c++ - copy values from array into another different size -
i have array [8] = {0}; , array b[20] = {0};
i want move values b[12...20] a[0...8]. how can change indices? there formula? b[12] -->a[0] b[13] -->a[1]
thank you.
use std::copy. works user defined types too:
std::copy(b+12, b+20, a); or, in c++11,
std::copy(std::next(b,12), std::end(b), std::begin(a));
Comments
Post a Comment