开发者

Method that takes a 2D array as a parameter, in c

开发者 https://www.devze.com 2023-04-01 20:36 出处:网络
I need to pass a 2D array into the method below: int pipeChild_1(int pipedes[], char *argsArray[][]); 开发者_Python百科

I need to pass a 2D array into the method below:

int pipeChild_1(int pipedes[], char *argsArray[][]);

开发者_Python百科

But the compiler gives that error:

array has incomplete element type 'char *[]'


Unfortunately you can't do that - 'c' only knows about pointers not about arrays.

If the size of the array is fixed (or at least the last dimension) you can pass that to the function, but a more common method is to pass a pointer to the array and the dimensions separately

eg Passing multidimensional arrays as function arguments in C or http://c-faq.com/aryptr/pass2dary.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号