title: for loop runs twice in C
body: <p>I am new to C programming. And I was doing a practice, and the question goes like this: Use the ?: operator and the for statement to write a program that keeps taking the characters entered by the user until the character q is accounted.</p>
  
  <p>And here is the program I wrote:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  main()
  {
      int x, i=0;
      for (x = 0; x == 'q'? 0 : 1; printf("Loop %d is finished\n",i))
      {
          printf("Enter q to exit!!!\n");
          printf("Please enter a character:\n");
          x=getc(stdin);
          putc(x,stdout);
          ++i;
      }
      printf("\nThe for loop is ended. Bye!");
  
      return 0;       
  }
  </code></pre>
  
  <p>The problem is: every time I enter a "non-q" character, the loop seems to run twice.
  I don't know what is wrong with my program. 
  Please help!</p>