how to return two dimensional char array c++?

前端 未结 8 2136
攒了一身酷
攒了一身酷 2020-12-03 15:23

i ve created two dimensional array inside a function, i want to return that array, and pass it somewhere to other function..

char *createBoard( ){  
  char          


        
8条回答
  •  温柔的废话
    2020-12-03 15:45

    The simple answer to your question is char**.

    Having said that, DON'T DO IT ! Your "board" variable won't last outside createBoard().

    Use boost::multi_array and pass it as a reference to createBoard() or return it directly (but if you do that, it will be copied).

提交回复
热议问题