B
bg
Hi All,
I'm bit confused of variables with global scope which is declared with
extern storage class.
Consider the following piece of code code in file A.c.
File: A.c
==================
#include "A.h"
int GData:
main()
{
GData = 5;
}
=====================
where file A.h is
File: A.h
==================
extern int GData;
==================
So effectively in A.c, the same variable is first declared as extern
and then defined in the same file.
Can anyone please tell me how will the c compiler interpret this ???
Also, whether there is any difference in the storage areas of global
variables, file scope static variables and function scope static
variables.
I'm bit confused of variables with global scope which is declared with
extern storage class.
Consider the following piece of code code in file A.c.
File: A.c
==================
#include "A.h"
int GData:
main()
{
GData = 5;
}
=====================
where file A.h is
File: A.h
==================
extern int GData;
==================
So effectively in A.c, the same variable is first declared as extern
and then defined in the same file.
Can anyone please tell me how will the c compiler interpret this ???
Also, whether there is any difference in the storage areas of global
variables, file scope static variables and function scope static
variables.