+ 3
A typedef creates an alias for a type. You can typedef a simple type or a more complicated user-defined type such as a struct, union, or enum, which otherwise would require syntax like “enum foo x”. A typedef also allows more strict type-checking than just declaring something with, say, “struct mystruct xxx”. An enum declaration allows new names and “values” to be defined and used in the code. In the days when C didn’t have a standard “bool” type, a common enum used to be.
22nd Nov 2017, 4:26 PM
Ben
Ben - avatar