Pass 2D array to function by reference

后端 未结 1 325
自闭症患者
自闭症患者 2021-01-14 05:34

So in my main function I\'m creating a 2D array:

int dataDim = 100;
float inData[2][dataDim];

I want to pass it to a function where I will

相关标签:
1条回答
  • 2021-01-14 06:26

    in C, multidimensional arrays' sizes must be known to pass as such, although some sizes may be omitted, if you like.

    Exact

    void function(float array[][100]); 
    void function(float (*array)[100]);
    

    Syntactically Valid

    Although the compiler may legally ignore the size 2.

    void function(float array[2][100]);
    
    0 讨论(0)
提交回复
热议问题