title: replace multiple blanks with one blank in C
body: <p>I'm writing some simple c programming code to replace a string of multiple blanks with a single blank. my code is as follows but it obviously contains errors. I'm trying to avoid the use of array or pointers. So any advice on how to correct my mistake? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void)
  {
      int c,d;
      d=0;
      while((c=getchar())!=EOF)
          {
          if (c==' ')
              {
                  d=getchar();
                  if (d!=' '&amp;&amp;d!=EOF)
                      putchar(c);
              }
          putchar(c);
          }
  }
  </code></pre>