开发者

Returning an Array from a C++ Function [duplicate]

This question already has answers here: 开发者_开发技巧 Closed 12 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜