How can I pass a dynamic multidimensional array to a function?

后端 未结 9 2309
再見小時候
再見小時候 2020-12-19 05:48

How can I pass a multidimensional array to a function in C/C++ ?

The dimensions of array are not known at compile time

9条回答
  •  萌比男神i
    2020-12-19 06:22

    I think this is a GCC extension (or a quite modern C feature), but it can be quite convenient:

    void foo(int bar[n][m], int n, int m) {...}
    

提交回复
热议问题