Ohmu said:
Hi!
How to pass an (multidimensional)array of something to a function with
reference/pointer?
Can anyone help me with that?
Thanks,
Ohmu
Here's how to prototype and call functions with arrays, references and
pointers.
// one dimension with pointer
void function(int *a);
int array[10];
function(array);
// two dimensions with pointer
void function(int (*a)[20]);
int array[10][20];
function(array);
// three dimensions with pointer
void function(int (*a)[20][30]);
int array[10][20][30];
function(array);
// one dimension with reference
void function(int (&a)[10]);
int array[10];
function(array);
// two dimensions with reference
void function(int (&a)[10][20]);
int array[10][20];
function(array);
// three dimensions with reference
void function(int (&a)[10][20][30]);
int array[10][20][30];
function(array);
john