directives

C Preprocessor Directives

C Preprocessor Directives

The C preprocessor is responsible for processing directives before the code is compiled. Common preprocessor directives include #define, #include, and #ifdef.

Define Directive

#include 

#define PI 3.14

int main() {
    printf("The value of PI is: %.2f\n", PI);
    return 0;
}
    

This program demonstrates the use of the #define directive to define a constant value.

Include Directive

#include 
#include 

int main() {
    double result = sqrt(16);
    printf("Square root of 16 is: %.2f\n", result);
    return 0;
}
    

This program uses the #include directive to include the math.h library for the