How do I return a char array from a function?

后端 未结 6 1133
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 13:13

I\'ve tried the following:

char[10] testfunc()
{
    char[10] str;

    return str;
}
6条回答
  •  误落风尘
    2020-11-28 14:08

    With Boost:

    boost::array testfunc()
    {
        boost::array str;
    
        return str;
    }
    

    A normal char[10] (or any other array) can't be returned from a function.

提交回复
热议问题