Passing 2-D array as argument

后端 未结 6 902
误落风尘
误落风尘 2020-12-31 14:03

I am trying to pass a 2-d array to a function which accept a pointer to pointer. And I have learnt that a 2-d array is nothing a pointer to pointer(pointer to 1-D array). I

6条回答
  •  长情又很酷
    2020-12-31 14:48

      void myFunction(int arr[][4])
    

    you can put any number in the first [] but the compiler will ignore it. When passing a vector as parameter you must specify all dimensions but the first one.

提交回复
热议问题