+ 2
Why the code below is giving the output 16?
8 Respuestas
+ 5
There is a concept of padding, alignment and data packing in structure which is the cause for occupying extra space.
Reference link
https://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/
This thread has some discussion on it.
https://www.sololearn.com/Discuss/2053833/?ref=app
+ 2
It is because there are two variables and both are sharing same memory area for this particular case that is 8 and 8...
+ 2
Avinesh Thank you very much!
+ 2
Manthan Gohel Welcome.
Nice to know it helped.
+ 1
Something seems to be missing.
int is size 4, char* size 8.
How does that become 16?
+ 1
But in this particular case it is taking 8 bytes for int also , if one more int variable is defined then also it is printing same answer
+ 1
~ swim ~ Also thank you too.