Structure Variables

After you make a structure, you can declare variables of that type. You can declare such variables in the procedure and module scopes.

Access to structure values

To store and return values of a member of a structure, you use the same syntax as used by properties on an object. You write the member access operator (.) between the structure variable name and the member name.

structure.member = 42
Print structure.member

Assignment to structure variables

You can do assignment with structure variables, but only if they are the same structure type. This copies all the elements of one structure to the same elements of the other.

If a structure element is a reference type (these include objects, strings, and arrays), then the pointer to the data is copied. Thus, a change to an object element through one structure then shows the same change when you go through the other structure.

See also