struct x {
int *u;
};
struct y {
struct x *z;
};
int main()
{
static y b;
static int g=7;
b.z->u=&g;
}
The statement b.z->u=&g
gives a segmentation error. If I remove the static
in front of int g
:
int g=7;
b.z->u=&g;
The code executes properly.