Currently learning about the extern variable .
I have declared a variable called
int a=10
in a header file head.h
int b=10
in a source file file.c
In file1.c
I used
extern int b;
and printed the variable b using printf.
when i use
extern int a
.It shows an error saying it cannot find the referenced variable . Is it something to do with compiler or ANSI C that does not look up for references in header when extern is used?
I have to use #include "head.h" to print variable a.
Can anyone explain whether its ANSI or visual studio problem?