Hi friends,

I am beginning to practice C from K&R. Although I am only familiar with the language, this time I want to invest time learning it
thoroughly. I've written this practice excercise program to replace more than a single blank in an input with only a single blank in the
output. Here's the code.

Code:
#include <stdio.h>

/*A program that displays keyboard input to the monitor, but trimming
more than a single space to a single space I've not replaced tabs with single 
spaces yet*/

#define SPACE 1

void main()
{

 int c, state;
 c=0;
 state=SPACE;
 while ((c=getchar()) != EOF)
 {
  if (!(state && (c==' '))) putchar(c);

  if (c==' ')
  {
   state=SPACE;
  }
  else
  {
   state= !SPACE;
  } 
 }
}
Although I've tested it four to five times, I don't know if I can be sure as to whether it is right, since I've made guesses about the
BITWISE operators such as NOT to be the same as the logical NOT ! and the BITWISE AND to be the same as the LOGICAL AND (&&). Also, on purpose, I have not yet detected tabbed spaces.

Could you gurus please tell me if I've written this program correctly?