Skip to main content

Posts

Showing posts with the label Preprocessor Commands

Preprocessor Commands

C is unusual in that it has a pre-processor. This comes from its Unix  origins. As its name might suggest, the preprocessor is a phase which occurs  prior to compilation of a program. The preprocessor has two main uses: it  allows external files, such as header files, to be included and it allows macros  to be defined. This useful feature traditionally allowed constant values to be  defined in Kernighan and Ritchie C, which had no constants in the language. Pre-processor commands are distinguished by the hash (number) symbol  ‘#’. One example of this has already been encountered for the standard  header file ‘stdio.h’. #include <stdio.h>  is a command which tells the preprocessor to treat the file ‘stdio.h’ as if it were the actually part of the program text, in other words to include it as  part of the program to be compiled. Macros are words which can be defined to stand in place of something  complicated: they are a way ...