C Program to implement the usage of basic preprocessor directives..

First, Create a seperate new file named newfile.c


void input(int *x,int *y)
    printf("\nEnter any two numbers..");

And then,you can include this file in another c file using #include"newfile.c" as follows..

#include"newfile.c" //File Inclusion ..

#define maxi(a,b) (a>b?a:b) // Macro Expansion

void main()
    int a,b;
    printf("\nThe maximum of two numbers is..%d",maxi(a,b));

    #ifdef maxi    // Condition Compilation..

      printf("\nThe macro Maxi is defined..");
      printf("\nThe Macro Maxi is not defined..");
    #endif // maxi

No comments:

Post a Comment