From the course: Complete Guide to C++ Programming Foundations

Unlock this course with a free trial

Join today to access over 25,000 courses taught by industry experts.

Preprocessor directives

Preprocessor directives

- [Instructor] C++ is a compiled language. So the code goes through a pipeline of software tools that extract the semantic elements written by the programmer. One of the first steps your code goes through is the pre-processor, which is not related to the microprocessor. It's actually a piece of software and part of the compiler tool chain. There are several directives addressed to the pre-processor, which contain information about what to add or remove in the code. The compiler will receive a somewhat modified or rather pre-processed version of the code. These directives like #include, #define and #ifdef are useful for including libraries in your code, defining constant, and selecting blocks of code for different compiling scenarios. So let's see some popular directives. First off, all directives start with a hash character, also known as number or pound, and they occupy one line each. There's actually one directive I've been using in all the exercises you've seen so far. That's the…

Contents