Multidimensional array transfer

I know that for one-dimensional arrays I can ...

void g(int x[]) {} void f(int a, int b) { int x[a]; g(x); } 

But with a code, for example ...

 void f(int a, int b) { int x[a][b][4]; g(x); } 

What would a signature like g (x) look like?

+4
source share
2 answers
 void g(int x[][b][4]) // b must be known in advance {} 

Otherwise, explicitly pass b

For instance:

 void g(int b,int x[][b][4]){ } int main() { int a=4,b=6; int x[a][b][4]; g(b,x); return 0; } 
+5
source

You need to specify the sizes of the arrays:

 void g(int x[][2][3]){ /* stuff */ } int main() { int x[1][2][3]; g(x); return 0; } 
0
source

All Articles