title: Working of getchar and putchar or example in The C language 2nd Edition
body: <p>CODE 1:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
   int main()
   {
       int c;
       while ((c = getchar()) != EOF)
       putchar(c);
       return 0;
    }
  </code></pre>
  
  <p>CODE 2:</p>
  
  <pre><code>   #include&lt;stdio.h&gt;
  
      main( )
      {
          int c,d;
          c=getchar();
          d=getchar();
          putchar(c);
          putchar(d);
     }
  </code></pre>
  
  <p>1) If
            Input : bo
            Output : bo
     I got to know this in 2nd program that it stores both in variables c and d but where does it stores them in 1st program.</p>
  
  <p>2)Pl. explain the working of first program why it repeats any word despite of its length that is more than one character.</p>
  
  <p>3) From book i got to know that EOF is encountered whenever I enter or there is some error but even if I press enter this program doesn't stops but it prints nextline character again.</p>