From the course: C Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Type aliases

Type aliases

- [Instructor] Type aliases can be handy in instances where a type declaration becomes cumbersome or it may vary on different target systems. This is typedef.cpp from chapter four of the exercise files. And you'll notice that I'm including this C standard int ,cstdint, header. And this defines these types, uint32 t and uint64 t. And what these are unsigned integers of a specific size, 32 bits and 64 bits respectively. And these are defined in this header. Now how are they defined? They're defined using typedefs. So we have two typedefs here. We're going to be calling these types points t and rank t. So points t will be an alias for uint32 t and rank t is an alias for uint64 t. And we're using these here in our structure for a scoring system of some sort. We have points and we have rank. And I initialize it down here and I print out the values here. And we'll go ahead and run this. Score s had five points and a rank of…

Contents