6.8 Structures and Functions


Objectives:

At the end of this lesson you will be able to:

pass structures by value

It is certainly possible to pass structures by value, which passes a copy of the original structure to a function. The disadvantage to this process is evident when dealing with large structures which will increase memory requirements and slow the system down. Consequently, passing by reference is the most economical method of dealing with structures and functions. The function will access the actual address locations of where the structures are stored as opposed to working with copies of the structures.

6.8 Structures and Functions


Example 6.5: Structures and Functions


Use unions

A union is a struct, contains only one object from its list of members (although that object can be an array or a class type) during the program execution.


6.8 Structures and Functions



6.8 Structures and Functions




6.8 Structures and Functions