I have declared variable x in main.c file. I want to access this variable in another file FileA.c. That's why i used extern storage class
FileA.cCode:#include <stdio.h> extern int x; int main () { x = 1; fun (x); return 0; }
I don't know why compiler show error error: 'x' undeclared (first use in this function)Code:#include <stdio.h> void fun ( ) { x++; printf ("x = %d \n", x); }