Getting segmentation fault while accessing the data from a static global array from another file; the pointer was passed as a function argument. The memory address shows the same from both file.
In file1.c
static long long T[12][16];
...
/* inside some function*/
printf(" %p \n", T); // Check the address
func_access_static(T);
...
In file2.c
void func_access_static(long long** t)
{
printf(" %p \n", t); // shows the same address
printf(" %lld \n", t[0][0]); // gives segmentation fault
}
Am I trying to do something that can't be done? Any suggestion is appreciated.