title: C: reading a file without printing the same line twice
body: <p>I'm trying to figure out how to do this, but I'm new to C and I want to know if my logic is the most efficient way to solve this problem.</p>
  
  <p>The easiest way I can think of is:</p>
  
  <ol>
  <li><p>read the first line</p></li>
  <li><p>store the line in a buffer1</p></li>
  <li><p>read the second line</p></li>
  <li><p>store the second line in a buffer2</p></li>
  <li><p>if buffer1 != buffer2, print buffer1 and erase buffer1. store line 3 in buffer 1. repeat from step 4.</p></li>
  <li><p>if buffer1 = buffer2, erase buffer1, store line 3 in buffer 1, and repeat from step 4.</p></li>
  </ol>
  
  <p>If the file contains:</p>
  
  <pre><code>ok ok
  
  ok
  
  ok
  </code></pre>
  
  <p>the result should be:</p>
  
  <pre><code>ok ok
  
  ok
  </code></pre>