I can't figure out what is wrong with this chunk of code (and couldn't find any advice from previous Q&A):
#include<stdio.h>
void fld(const int **b){
int i, j ;
printf("Hello R\n");
for (i=0; i<3; i++){
for (j = 0; j<3; j++)
printf("%d", b[i][j]);
printf("\n");
}
return;
}
int main(){
int i, j;
int b[3][3] = {
{1,1,1},
{1,2,1},
{2,2,2}
};
fld((void **)b);
system("pause");
return;
}
I tried to pass a matrix to a function fld and to print it out, but it keeps reporting segmentation fault while running the code.