assume there is a header file: a.h and source file : a1.c a2.c ... an.c; n>=1, which means it may only have one source file, or have several source files.
my question
As you said, variable must be defined in the c file and declaration should be located in header file.
You have to define a global variable in any c file and declare 'extern' in header file.
Example)
1) define global variable in a1.c
int g;
2) declare global variable in a.h
extern int g;
3) include header file in other c files
#include "a.h"
// to do something