title: Check if a character is a space
body: <p>I'm creating an absurdly simple program in C to mess around with <code>getchar()</code>. The program will print out what you input until you press enter and it will guarantee that your lines are no more than 80 chars each. To do this, I keep a running count of how many characters have been entered. Once the char count hits 70, the next space encountered will cause a line break. If no space is encountered between 70-80, a line break will occur regardless. I realize this is a super naive implementation and could be optimized left and right, but remember, I'm just messing around: </p>
  
  <pre><code>while ((c = getchar()) != '\n') {
      if (lineLengthCount &lt; 70) {
          putchar(c);
          lineLengthCount++;
      }   
      else if (lineLengthCount &lt; 80 &amp;&amp; (c == ' ')) {
          printf("%c\n", c); 
          lineLengthCount = 0;
      }   
      else {
          printf("%c\n", c); 
          lineLengthCount = 0;
      }   
  }   
  </code></pre>
  
  <p>The problem is the <code>c == ' '</code> conditional doesn't seem to be actually checking for a space. I get output like this: </p>
  
  <pre><code>fitter happier more productive comfortable not drinking too much regula
  r exercise at the gym three days a week getting on better with your ass
  ociate employee contemporaries at ease eating well no microwaved dinner
  </code></pre>
  
  <p>where I was hoping that the lines would be truncated when a space was encountered. Instead, no matter what character is entered after line 70, a new line is created. am I missing something?  Does <code>' '</code> really mean any character? </p>