title: Remove comments from C program
body: <p>Following is my code to remove comments from a C program. But the comment lines don't get removed. It removes <code>/*</code> and <code>*/</code>, but doesn't remove the sentence between this delimiters.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  main(int argc, char *argv[]) {
      FILE *fp, *ft;
      char ch;
      if (argc &lt; 3) {
          printf("No file name given");
      }
      fp = fopen(argv[1], "r");
      ft = fopen(argv[2], "w");
      if (fp == NULL)
          printf("Opening error");
      if (ft == NULL)
          printf("Opening error");
      while (1) {
          ch = fgetc(fp);
          if (ch == EOF)
              break;
          if (ch == '/') {
              ch = fgetc(fp);
              if (ch == '*') {
                  putc(' ', ft);
              }
          } else if (ch == '*') {
              ch = fgetc(fp);
              if (ch == '/') {
                  putc(' ', ft);
              }
          } else {
              putc(ch, ft);
          }
      }
      fclose(fp);
      fclose(ft); 
  }
  </code></pre>
  
  <p>Please help me to remove comment lines.</p>