Learn how to declare preprocessing statements.

We'll cover the following


A macro is a segment of code that is replaced by the value of the macro.

Macro is defined by the #define directive. Although you can write C programs without knowing anything about the preprocessor, you should not.

All good, generalised, and maintainable programs usually use C preprocessor directives in them.

What to expect

This chapter presents some preprocessor examples. If you can solve them, you are well on your way to becoming a mature C programmer.

Note This chapter is a little different from the previous chapters. Instead of providing you with space to solve the example, we will show you how to write programs using preprocessed statements efficiently. However, you may re-run the code after editing it to see the output.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.