Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • C Preprocessor directives

    • 0
    • 6
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 290
    Comment on it

    The preprocessing of C source code is done before it is compiled by the compiler. The Preprocessor directives are the command used for preprocessing which starts with "#" symbol. The list of preprocessor directives that C language offers is given below:

    1. Macro i.e. #define
    2. Header file inclusion i.e. #include.
    3. Conditional compilation i.e. #ifdef, #endif, #if, #else, #ifndef.
    4. Other directives i.e. #undef, #pragma, #undef.

    Example program for #define, #include preprocessors in C:

       #include <stdio.h>
        #define height 150
        #define number 8.78
        #define letter 'D'
        #define lettersequence "PQRS"
    void main()
       printf("value of height : %d \n", height );
       printf("value of number : %f \n", number );
       printf("value of letter : %c \n", letter );
       printf("value of lettersequence : %s \n", lettersequence);


    value of height : 150
    value of number : 8.780000
    value of letter : D
    value of lettersequence : PQRS

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: