Returning an Array from a C++ Function [duplicate]
Possible Duplicate:
howto return a array in a c++ method?
How can an array be returned from a function? I'm going for an effect like this:
int getArray()
{
return {1, 2, 3, 4, 5};
}
...
int myArray[5] = getArray();
Either dynamic allocation or std::vector
. You can't return an array by value.
精彩评论