title: Logical Error in my C Code
body: <p>I am a beginner, just learning C; so, please be patient with me. </p>
  
  <p>I am trying to write a very simple program that goes through a string, counts the characters in each word, and then replaces those words with the number of their characters. My problem is that I am stuck in an infinite loop and cannot figure out why! Here is the code:</p>
  
  <pre><code>#define NEWLINE '\n'
  #define SPACE ' '
  
  int main(int argc, char *argv[]) {
    int character;
    int count = 0;
  
    printf("\nType in a sentence of any lenght, then hit ENTER!\n");
    character = getchar();
  
    while (character != NEWLINE) {
  
       while ((character != SPACE)  || (character != NEWLINE)) {
          count++;
          character = getchar();
       }
  
    printf("%d ", count); 
    count = 0;
  
    if (character != NEWLINE) {
       character = getchar();
       }
    }  
  
   printf("\n");
   system("PAUSE"); 
   return 0;
   }
  </code></pre>
  
  <p>Thanks for everyone who helped me! I guess I go back and study logical operators a bit more.</p>