This question already has answers here: Trying passing as a paramater two dimesional array In C (3 answers) Your post has been associated with a similar question. If this question doesn’t resolve your question, ask a new one.
Closed 38 mins ago by rsjaffe, klutt c . (Private feedback for you)
rsjaffe and klutt, there is no answer what I am looking for, I am asking about this in low-level programming principally and the answers there are not practical.
I have encountered a problem with passing two dimensional arrays to other function as parameter. It was not working when I tried as below.
#include <stdio.h>
int display(int **src) {
printf("%d", src[0][1]);
}
int main() {
int arr[2][2] = {{1,2}, {3,4}};
display(arr);
return 0;
}
It raises segmentation fault error. So I changed the display function as below
int display(int src[][3]) {
printf("%d", src[0][1]);
}
I am not sure why first case raises error. Please help me to understand deeply about this case.