Overview
A type is said to be derived if they are defined relative to other types.
Aggregate Data Types
The aggregate data types are so called because they combine multiple instances of one or several other data types.
Arrays
An array is a contiguous sequence of objects. An array is either a fixed-length array or a variable-length array.
Evaluation of an array A
returns &A[0]
, i.e. a pointer to the first array element. This is called array decay.
Fixed-Length
A fixed-length array (FLA) has a predetermined size. Their stack allocations can be computed at compilation time.
Variable-Length
A variable-length array (VLA) has its size determined at runtime. Their stack allocations must be determined with respect to other registers available to the frame.
Structures
A struct
is a grouping of data together. It has the following general form:
Unions
A union
is a grouping of data together but with overlaid storage. It has the following general form:
Pointers
Pointers are another type of derived type. They are listed in more detail here.
Functions
Functions are another type of derived type. They are listed in more detail here.
Bibliography
- Bryant, Randal E., and David O’Hallaron. Computer Systems: A Programmer’s Perspective. Third edition, Global edition. Always Learning. Pearson, 2016.
- “ISO: Programming Languages - C17,” April 2017, https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf.
- Jens Gustedt, Modern C (Shelter Island, NY: Manning Publications Co, 2020).
- Van der Linden, Peter. Expert C Programming: Deep C Secrets. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.