C
C_Programmer
Question#1:
==========
==========
What is the default value for any Static Global variable?
Example:
A.c:
=====
static int i;
Does "i" get to initialized to "0"?
Question#2:
==========
==========
Can I access a Static Global variable from a different file as given in
the following example?
Example:
A.c:
=====
static int i;
int * foo(void)
{
return &i;
}
B.c:
====
int *a = foo();
In the above code, is it valid to make a call "int *a = foo();" in B.c?
What happens when I try it?
==========
==========
What is the default value for any Static Global variable?
Example:
A.c:
=====
static int i;
Does "i" get to initialized to "0"?
Question#2:
==========
==========
Can I access a Static Global variable from a different file as given in
the following example?
Example:
A.c:
=====
static int i;
int * foo(void)
{
return &i;
}
B.c:
====
int *a = foo();
In the above code, is it valid to make a call "int *a = foo();" in B.c?
What happens when I try it?