+ 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; }

8th Sep 2019, 7:36 AM
Preet
9 Antworten
+ 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
8th Sep 2019, 8:04 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
thanks ~ swim ~ but what about the array of size 10 with???
8th Sep 2019, 8:26 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
thanks alot ~ swim ~
8th Sep 2019, 9:25 AM
✳AsterisK✳
✳AsterisK✳ - avatar
0
but why is it like that and not in the actual pack of 4??? ~ swim ~
8th Sep 2019, 9:07 AM
✳AsterisK✳
✳AsterisK✳ - avatar