In this article, we have explained how to calculate the memory size of a struct in C and C Programming Language. To find the actual size, you need to understand two concepts of padding and packing. The size is not the sum of individual elements so read on.
Table of contents:
Structure PaddingStructure Packing
Let us explore the ideas with code examples and explanation.
Structure Padding
Computer stores structure using the concept of word boundary.
The size of a word boundary is machine depe...
Published on September 16, 2021 09:48