title: The C Programming Language, Ch.1 Exercise 1.10 (Getchar and Putchar)
body: <p>I've been working on this for 2 hours and I am stuck... I found the answer online, but that isn't going to help me learn the concept that I'm obviously missing.</p>
  
  <p><strong>Prompt:</strong> Write a program to copy its input to its output, replacing each tab by <code>\t</code> , each backspace by <code>\b</code> , and each backslash by <code>\\</code> . This makes tabs and backspaces visible in an unambiguous way.</p>
  
  <p>Here's what I came up with, it doesn't replace a <code>tab</code> or <code>\</code> with the indicated <code>putchar</code>, it just adds it in front of it.(I didn't do backspace because I can't really input a backspace...):</p>
  
  <p>This is how I read the code. What am I missing?: </p>
  
  <p>"There is some integer <code>c</code>. <code>c</code> is equal to the input. When the input is not equal to end of file proceed. If input is tab then the output <code>\t</code>. If input is <code>\</code> then output <code>\\</code>. Output the input to console."</p>
  
  <pre><code>int c;
  
  while((c=getchar())!=EOF)
  {
      if(c=='\t')
          {
              putchar('\\');
              putchar('t');
          }
  
      if(c=='\\')
          {
              putchar('\\');
              putchar('\\');
          }
      putchar(c);
  }
  </code></pre>