How many instance of the variable will be produced if I declared a static
global variable in one header file, and two .c / .cpp files included the
header file? Example as the following:
<abc.h>
static int abc = 1;
...
<abc1.c>
#include "abc.h"
void ChkAbc1()
{
int* Addr = &abc;
}
...
<abc2.c>
#include "abc.h"
void ChkAbc2()
{
int* Addr = &abc;
}
...
One more question, if a static global variable declared in a .c / .cpp file,
can I extern this variable on the header file? Example as the following:
<abc.h>
extern int abc;
...
<abc.c>
#include "abc.h"
static int abc = 1;
...
<main.c>
#include "abc.h"
void main()
{
int* Addr = &abc;
}
...
Thanks in advance,
Best Regards,
Elliott