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 - C Tutorial
From the course: C Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Overview of data types3m 21s
-
(Locked)
Integer types2m 43s
-
(Locked)
Floating point types6m 51s
-
(Locked)
The auto type4m 2s
-
(Locked)
Qualifiers4m 33s
-
(Locked)
Type aliases2m 5s
-
(Locked)
Primitive arrays5m 23s
-
(Locked)
C-strings4m 37s
-
(Locked)
Structures2m 50s
-
(Locked)
Challenge: Library card2m 9s
-
(Locked)
Solution: Library card1m 16s
-
-
-
-
-
-
-