6.8. A trick to describe complex data types¶
Complicated data types, especially ones which use pointers, can be difficult to declare and even difficult to correctly read (understand) the data declaration found in an existing program. The key is to be able to describe the data type in English terms. Here is a simple trick to translate a data declaration to a description of the data type.
- Start with the identifier.
- Draw circular clockwise arrows around the identifier to each operator in the data declaration until you reach the base data type. Parenthesis can alter the arrows drawn.
- Start at the identifier and read the operators following each arrow to describe the data type.
Here are some examples …