![]() Overall, this gives you a way to define constant values that are effectively global and can be used any place. It’s conventional to write macro names in ALL_CAPS even though that’s not technically required. So anyplace it occurs in the text will just be replaced with nothing. In that case, the macro exists and is defined, but is defined to be nothing. ![]() Things that are built-in, like stdio.h, stdlib.h, math.h, and so on, you can include with angle brackets: We can split header files into two categories: system and local. While the spec allows for all kinds of behavior with #include, we’re going to take a more pragmatic approach and talk about the way it works on every system I’ve ever seen. This is, of course, a way to include other sources in your source. Let’s start with the one we’ve already seen a bunch. ![]() You can define macros that are substituted… and even macros that take arguments! 19.1 #include And then the compiler builds the whole thing.īut it turns out it’s a lot more powerful than just being able to include things. We’ve already seen this to an extent with #include! That’s the C Preprocessor! Where it sees that directive, it includes the named file right there, just as if you’d typed it in there. And it outputs the C code, which then gets compiled. It’s almost like there’s a language on top of the C language that runs first. Before your program gets compiled, it actually runs through a phase called preprocessing.
0 Comments
Leave a Reply. |