Programmer Guide > Working with Structures
  

Working with Structures
PV‑WAVE supports structures and arrays of structures. A structure is a collection of scalars, arrays, or other structures contained in a variable. Structures are useful for representing data in a natural form, for transferring data to and from other programs, and for containing a group of related items of various types.
Before a structure can be used, it must be defined. When you define a structure, you actually create a new data type. The definition includes a structure name and a list of structure fields. Each structure field is given a tag name and tag definition (data type). The tag definition may be an expression or a variable. It defines the data type of the data that can be placed in the field. A structure definition, per se, does not contain any data values; however, a variable of a particular structure type always contains data.
A structure field may be defined as any type of data representable by PV‑WAVE. Fields can contain scalars or arrays of any PV-WAVE data type, including other structures or arrays of structures.
Just as you cannot alter the basic definition of an integer or floating-point data type in PV-WAVE, you cannot alter a structure definition after it has been created. You can, however, delete a structure definition as long as it is not currently being referenced by any variables. See the next section for more information on deleting structure definitions.
When structure definitions are referred to, they must be enclosed in braces. For example:
PRINT, {struct_name}
The braces distinguish structure definitions from variable names, function names, or other identifiers.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.