79780290

Date: 2025-10-01 16:47:46
Score: 2
Natty:
Report link

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.

Reasons:
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Genius