title: Using #undef preprocessor directive
body: <blockquote>
    <p>Here are the 2 programs with very minor change.</p>
  </blockquote>
  
  <p><br/></p>
  
  <blockquote>
    <p>Practice.c</p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define P (i+j)
  
  main()
  {
    int i,j,k=0;
    printf("\nI = ");
    scanf("%d",&amp;i);
    printf("\nJ = ");
    scanf("%d",&amp;j);
    k=P;
    printf("\nValue of Defined Macro P = %d\n",k);
  
    #undef P
      printf("\nValue of Undefined Macro P = %d\n",k);
  }
  </code></pre>
  
  <p>Output of the above program is:</p>
  
  <pre><code>I = 5
  
  J = 9
  
  Value of Defined Macro P = 14
  
  Value of Undefined Macro P = 14
  </code></pre>
  
  <p><br/></p>
  
  <blockquote>
    <p>New.c</p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define P (i+j)
  
  main()
  {
    int i,j,k=0;
    printf("\nI = ");
    scanf("%d",&amp;i);
    printf("\nJ = ");
    scanf("%d",&amp;j);
    k=P;
    printf("\nValue of Defined Macro P = %d\n",P);
  
    #undef P
      printf("\nValue of Undefined Macro P = %d\n",P);
  }
  </code></pre>
  
  <p>Output of the above program is :</p>
  
  <pre><code>Practice.c: In function 'main':
  Practice.c:15:48: error: 'P' undeclared (first use in this function)
      printf("\nValue of Undefined Macro P = %d\n",P);
                                                 ^
  Practice.c:15:48: note: each undeclared identifier is reported only once for eac
  h function it appears in
  </code></pre>
  
  <p><br/></p>
  
  <p>Now I want to know that why did <code>Practice.c</code> got successfully compiled and executed, where I used variable <code>k</code> to display the output, and why did <code>New.c</code> displayed error on using Macro Template <code>P</code> directly?</p>