Hi I have following 2 files
in a.c
I have
#include <stdio.h>
int i;
static int j;
int main()
{
printf("i = %d\n",i);
printf("j = %d\n",j);
return 0;
}
and in b.c
I have
#include <stdio.h>
extern int i=2;
extern int j=5;
In this example when I run, I get answer as 2,0 but complier throws warning initialized and declared ‘extern’
for both variables.
How b.c is able to access j
and not throws error since scope of j
is for a.c
only?