#include<stdio.h>
void foo(int **arr) {
arr[1][1]++;
}
main() {
int arr[20][20];
printf("%d\n",arr[1][1]);
foo((int**)arr);
printf("%d\n",arr[1][1]);
}
Segmentation Fault in C – Why This Code Generates an Error
arraysc++segmentation-fault
Best Answer
Details here
Now consider the following,
Output :