![]() |
CITS2002 Systems Programming |
← prev | next → | ![]() |
![]() |
|||
Defining our own datatypesWe can further simplify our code, and more clearly identify related data by defining our own datatypes.Recall material from Lecture-6 where structures, and arrays of structures were introduced. We preceded each structure's name with the struct keyword, and accessed structure elements using the 'dot' operator. Instead, we can use the typedef keyword to define our own new datatype in terms of an old (existing) datatype, and then not have to always provide the struct keyword:
As a convention (but not a C11 requirement), we'll define our user-defined types using uppercase names:
CITS2002 Systems Programming, Lecture 16, p3, 19th September 2023.
|