title: C Code - cannot insert new line via putchar.
body: <p>I have a source code in C.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define IN_W 1
  #define OUT_W 0
  #define SPACE 32
  #define TAB 9
  
  int main() { 
      int c, state, temp;
      state = OUT_W;
  
      while ((c = getchar()) != EOF) {
          if ((c != SPACE || c != TAB) &amp;&amp; (state == OUT_W)) {
              state = IN_W;
              temp = c;
              c = 13;
              putchar(c);
              c = 10;
              putchar(c);
              putchar(temp);          
          } else if (c != SPACE || c != TAB)
              putchar(c);     
          else 
              state = OUT_W;      
      }   
      return 0;
  }
  </code></pre>
  
  <p>What I want to achieve is I will type in some characters/words and catch those inputs by getchar. When ever getchar receive any characters besides space or tab, it will print a new line and then print those characters until it found a space or tab (abandon them). For example, when I type </p>
  
  <pre><code>123  eat    4bananas     in themorning
  </code></pre>
  
  <p>the program will print</p>
  
  <pre><code>123
  eat
  4bananas
  in
  themorning
  </code></pre>
  
  <p>I tried to integrate it with CR or LF, but it still print "123  eat     4bananas     in themorning". </p>
  
  <p>My questions are:
  1. What did I miss?
  2. In the last 'else', which one is more efficient for the running program:</p>
  
  <pre><code>    else 
          state = OUT_W;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>    else if ((c == SPACE || c == TAB) &amp;&amp; state == IN_W)
          state = OUT_W;
      else
          continue;        // or can I use single ';' since we do nothing in here?
  </code></pre>
  
  <p>That's all. Thank you for your help.</p>
  
  <p>Note: I tried playing with '\n' and '\t' too.</p>
  
  <p>Regards,
  Mario  </p>