Chapter 10: Creating Custom Data Types with typedef
As we saw in the last two chapters, C allows you to define your own types from enumerations (enum
types) and structures (struct
types). C also allows you to redefine types for the convenience of naming and to provide clarity about how to use the redefined type. The redefined type becomes a synonym for the original type. The purpose of this chapter is to create a synonym of one type from another, which is extremely useful to express the purpose of variables, not only through their names but also through their redefined types.
The following topics will be covered in this chapter:
- Creating custom named types from intrinsic types
- Creating new synonyms from other custom named types
- Simplifying the use of enumerations
- Simplifying the use of structures
- Exploring some important compiler options
- Using header files for custom types and the
typedef
...