Using a header file for custom types and the typedef specifiers
Because we have explored custom types (enumerations, structures, and the typedef
specifiers), it is now appropriate to explore how to collect these custom types into our own header file and include them in our program.
We have seen the following statements:
#include <stdio.h>
#include <stdbool.h>
These are predefined header files that provide standard library function prototypes – the typedef
specifiers, enumerations, and structures – related to those function prototypes. When a header file is enclosed in <
and >
, the compiler looks in a predefined list of places for those files. It then opens them and inserts them into the source file just as if they had been copied and pasted into the source file.
We can now create our own header file, say card.h
, and use it in our program...