in C , i have
struct a {
int a;
char b[16];
int c;
};
How is the memory of instances of struct a
, will it be flat with the struct area, or inside struct a
there are pointer, for example , will the struct sizeof be 4+16+4 , or 4+4+4 ?
what will happen if i have
struct a A,B;
A->b = B->b;
?
how is the memory of instances of struct a, will it be flat with the struct area, or inside struct a there are pointer
Flat.
The array member is a real array, the size of the struct
will be
2*sizeof(int) + 16 (+ padding)
what will happen if i have
struct a A,B A->b = B->b
A compilation error. Arrays are not assignable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With