Return an array in c++

前端 未结 11 2184
半阙折子戏
半阙折子戏 2021-01-02 12:14

Suppose I have an array

int arr[] = {...};
arr = function(arr);

I have the function as

 int& function(int arr[])
 {
//         


        
11条回答
  •  借酒劲吻你
    2021-01-02 12:30

    Well, arr is compatible with int*, not int&. Your code won't compile. Perhaps you wanted return arr[0]?

提交回复
热议问题