function reveives a 2-d array as parameter
hi all,
how can i write a function which receives a 2-d array?
my version:
Code:
#include <stdio.h>
int main(void)
{
void fun(int *arr[10]);
int twodarray[10][10] = {0};
fun(twodarray);
return 0;
}
void fun(int *arr[10])
{
int i;
for(i=0; i<10; i++)
{
printf("%d", arr[0][i]);
}
}
it can't be compiled, here's error mesaage
Code:
9 D:\Programes\OfficeWork\Dev-Cpp\Fun2darray\main.cpp cannot convert `int (*)[10]' to `int**' for argument `1' to `void fun(int**)'
Code:
void fun(int **arr)
{....}
not working neither
BTW, how can i deal with a 3-d array?
many thanks!