Why this generates segmentation fault?

Posted by avd on Stack Overflow See other posts from Stack Overflow or by avd
Published on 2010-03-15T15:21:11Z Indexed on 2010/03/15 15:29 UTC
Read the original article Hit count: 482

Filed under:
|
#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]);
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about segmentation-fault