Structure Member Alighnment and Padding (Part 4) | GeeksforGeeks

preview_player
Показать описание
Find Complete Code at GeeksforGeeks Article:

This video is contributed by Vishal Gulia

Please Like, Comment and Share the Video among your friends.

Install our Android App:

If you wish, translate into local language and help us reach millions of other geeks:

Follow us on Facebook:

And Twitter:

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

it was so easy tried everything but this was most easy to understand

shashanktripathi
Автор

I have a doubt.. after allocating the double, the index occupies till the 15th index and when we start allocating the integer ..why can't we allocate it at 4, index 4 was free nothing has at index 4 reply True or False for my approach
We are taking from the 16th index because it is in contagious memory Location so that it will continue forward not backwards?

the_Alchemist
Автор

I was trying to learn structure padding everywhere on the internet but after watching these 4 videos now my concept is cleared. Thank you so much sir you explained the concept so well. Please upload more videos like this. Thank You again!

omkidix
Автор

Here character c whole word will be accessed.
Also rule 2 holds good
Both concepts are correct

JKA-sfll
Автор

Very informative video . Thanks geeks for Geeks Team

adityachandra
Автор

this example means that system works as 64 bit machine? True Or False And Why?

Odo_ela_sabil_rabek
Автор

i think its totally depends on how we assign variable to the struct
if we just change the alignment of the assign variable then the size will gona definitely change
and do you want to comments on the long long and long datatype variable
i reallly wanaa to know..:)
Thanks ..(^_^)

adityachhawal
Автор

Can you check this code in 32 bit target, double variable after char will start at offset +4, we can verify by offsetof macro, so we can correct rule as alignment as per word size, not by size of type (especially double it differs)

rajeshsola