How do you know the size of Structure Variables?


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.


Related

Write about Character Arrays (or) Strings? Explain how to Declare & Initialize Strings?

String: A string is a sequence of characters that is treated as a single data item. Any group of characters defined in between Double quotation marks is a string constant. Ex:...

Write about Arrays of Structures?

We use structures to describe the format of a number of related variables. For ex: in analyzing the marks obtained by a class of students, we may use a template to describe student name and marks o...

Write about Call by Value and Call by Reference (or) Parameter Passing Techniques?

The techniques used to pass data from one function to another are known as parameter passing. “C” provides 2 mechanisms to pass arguments to a function. 1. Call by value (or) pass arguments by valu...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item