Pretend you don't know what C-arrays are and join the world of modern C++:
#include <array>
std::array<int, 8> getNums()
{
std::array<int, 8> ret = {{ 1, 2, 3, 4, 5, 6, 7, 8 }};
return ret;
}
If your compiler is too old to provide a std::
or std::tr1::
implementation of array<>
, consider using boost::array<> instead. Or, consider using std::vector<> either way.