Still confused with declaration and definition in term of C: if a header file is like:
#ifndef _BASIC_H_
#define _BASIC_H_
void test();
extern int i; //define or declare
#endif
and two source file f1.c and f2.c contain this header, then one source file need to define the variable "i".
but if the header file is like:
#ifndef _BASIC_H_
#define _BASIC_H_
void test();
int i; //define or declare
#endif
and two source files f1.c and f2.c, contain this header without define the variable "i" in any file, it still goes through when I use the variable.
my questions is when the variable is defined.
Thanks