|
The record and field types known from ordinary programming languages can be defined by using the constructs already introduced. But the specification of ADTs is not trivial even if one is familiar with it. Therefore, SDL offers the possibility to define record and field types in a conventional way known from programming languages. Records are specified with the keyword STRUCT:
A variable address of type address_type can then be declared::
and the variable address of type address_type can be assigned in the following way:
A certain component of the record can be accessed in the following way
Another frequently used data type is the file type. For this type SDL does not have a special language construct, but there is a predefined generator with name Array which can be used. In the following example a sort file type with 10 field elements of type address type is defined:
Suppose there is a variable file of sort file_type. then a field element can be accessed in the usual way:
|
Contact the webmaster with
questions or comments about this web site. |