P
parag_paul
Suppose I have a struct
typedef struct atype{
int a;
int b;
} at;
main(){
static at* j= 0;
j->a =1;
j->b = 2;
pin(j);
}
void* pin(at* b)
{
...
...
}
Now how are static pointers to a struct allocated, In a 32 bit
machine, I expect the that static at* j should keep 4 bytes in the
global space, But I will require 8 byte or the size of the structure
to use the above program safely,
Does the compiler figure out the type and the size at compile time and
allocates 8 bytes in the global space for this static pointer, since
each call will be changing this data I need to double sure about
this,
Any help
typedef struct atype{
int a;
int b;
} at;
main(){
static at* j= 0;
j->a =1;
j->b = 2;
pin(j);
}
void* pin(at* b)
{
...
...
}
Now how are static pointers to a struct allocated, In a 32 bit
machine, I expect the that static at* j should keep 4 bytes in the
global space, But I will require 8 byte or the size of the structure
to use the above program safely,
Does the compiler figure out the type and the size at compile time and
allocates 8 bytes in the global space for this static pointer, since
each call will be changing this data I need to double sure about
this,
Any help