i knew(i believe so) the difference between variable declaration and definition. i just wanted to know where(in which object) a variable will be defined which was declared with extern linkage(in a header file) and included this header file in many source file where the variable was used. i referred few declaration and definition links could not find info regarding this.
//globalheader.h//
extern int test_var;
//file1.c//
#include "globalheader.h"
static fn1();
fn1
{
int a;
a = test_var;
}
//file2.c//
#include "globalheader.h"
static fn2();
fn2
{
int b = 1;
test_var = b;
}
In the above code snippet test_var is declared with external linkage in globalheader.h which was included in both file1.c and file2.c. No where this test_var was defined but used, so where(in which object file) does this test_var will be allocated memory?