your declaration extern int *arr; does not match the definition int arr[10]; Which is why you should put the declaration into a header file and then include that header into both C files. In all likely hood the reason you get an undefined reference to arr is either that you only linked with the object from compiling file2.c or that the ...
hi, check out the following program ... a.c ----- extern void fun(); int a[10]; int main () { fun (); } b.c ----- extern int *a; void fun() { a++; printf ("%d",a); } If i compile the above two files together ... what should be the behavior of variable a in fun() , it should be pointing to the array right ...