3

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 be able to fill it up with data. How to pass it in a manner that I will be able to fill it up directly? Maybe

function(float** array)

and then accessing array[0][0] probably doesn't work? Strange how I can't find any quick example about this.

c0dehunter
  • 6,412
  • 16
  • 77
  • 139

1 Answers1

9

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]);
justin
  • 104,054
  • 14
  • 179
  • 226