How do you know the size of Structure Variables?
https://www.computersprofessor.com/2016/12/how-do-you-know-size-of-structure.html?m=0
|
We may use the unary operator ‘sizeOf’
to tell us the size of a structure (or any variable). The expression:
SizeOf( struct x);
Will evaluate the number of bytes
required to hold all the members of the structure x. If y is a simple
structure variable of type struct x, then the expression
SizeOf(y);
would also give the same answer.
However, if y is an array variable of type struct x,
then
sizeOf(y);
Would give the total number of bytes
the array y requires.
|