+ 1
Why is the size of the memory of the struct variable 'place' is 16 Bytes?
Code: #include <stdio.h> struct residence{ char city[10];//10 int plz;//4 }; struct address{ char street[20];//20 int housenr;//4 struct residence place; }; int main() { struct residence place; printf("%d Bytes ",sizeof(place)); return 0; }
9 Réponses
+ 4
every thing is explained here
https://www.google.com/amp/s/www.geeksforgeeks.org/is-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member/amp/
+ 2
memory is arranged as a group of 8 byte on a 64 bits machine and 4 on a 32 bits machine this allows an increase in processing speed
+ 1
thanks ~ swim ~ but what about the array of size 10 with???
+ 1
thanks alot ~ swim ~
0
but why is it like that and not in the actual pack of 4??? ~ swim ~