Yes, the third option is to use a C++ construct:
std::copy(&nums, &nums, myGlobalArray);
With any sane compiler, it:
- should be optimum in the majority of cases (will compile to
- is type-safe,
- gracefully copes when you decide to change the data-type to a non-primitive (i.e. it calls copy constructors, etc.),
- gracefully copes when you decide to change to a container class.