 We've been using Numbersign Include all throughout this course. When you include StandardIO.h, it's as if all the declarations in the StandardIO.h file were copied and pasted into your file. In any large project, your code won't fit into one file. Instead, you'll modularize your code with separate .c and .h files for each part. Consider this header file that begins with a type definition for a time of day, a specific hour and minute, and the hour can only be from 0 to 23. This other header file has a type definition for a duration, a span of time that can go more than 24 hours. Each data type has an associated set of functions. Notice this declaration in duration.h that uses the time of day structure. This has implications for how we write our code. Time of day.c has to include time of day.h, and duration.c has to include duration.h. Duration.h also has to include time of day.h, because that function we highlighted needs to access a time of day. We know that this has to happen because we've designed it this way. But what happens when someone writes a program to use functions from both these libraries? If someone's unaware of the way the inclusions are designed, they'll include both .h files, and that will result in time of day.h being included twice. We don't want that to happen. We need to use preprocessor directives to solve this problem. Here are the files. On the left is our C program, and on the right are the two header files that it uses. In order to avoid including time of day.h twice, what we're going to do is we're going to use the if not defined preprocessor directive, and see if something called time of day h has been defined or not. If it hasn't been defined, that means the preprocessor will include everything in the file up to the closing and if directive. And the key to making this all work is we are going to define time of day.h. By the way, it's a convention to use the name of the file in uppercase preceded by an underscore. Now that we've added these directives, let's see what happens when the compiler looks at the C file. The first thing it does is include time of day.h. Has this been defined yet? Nope, it's nowhere in our program so far, which means that effectively all of this material in here will be copied and pasted into our C program. The preprocessor now goes to the next include, which is duration.h. Duration.h also doesn't include time of day, and the first thing the preprocessor asks is, is there something called time of day h? Let's look at our program. Yes, it is defined, which means we are not going to do any of this again. It doesn't get copied and pasted again, and then the rest of duration.h does get copied and pasted into our C program effectively. Now we've solved the problem of having the time of day.h file included more than once. In fact, it's a good idea to use this if not defined trick everywhere, because you never know when you or someone else will be including your file inside another .h file. Let's do the same here in duration.h. We'll have the if not defined, the symbol will be the name of our file all in capital letters with underscores before and underscores instead of a dot, and we'll define that symbol and put an end if at the end of the file. And that is how to safely include multiple header files in multi-source file programs to ensure that no header file gets included more than once.