You can’t directly assign one C-style array to another in C++, that’s why foo[0] = myBar; fails. Arrays don’t support the = operator.The reason memcpy works is because it just does a raw memory copy, but that’s not type-safe.A more C++-friendly fix is to use std::array for the inner array (so both the outer and inner parts are assignable), or use std::copy_n / std::to_array to copy the contents.