title: Ternary operator in a for loop
body: <p>So I have the following code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int f(char *c)
  {
      static int i=0;
      for (;*c;*c++=='a'?i--:i++);
      return i;
  }
  int main()
  {
      for(int i=1; i&lt;4; i++)
          printf(&quot;%d:%d\n&quot;, i, f(&quot;buba&quot;));
      return 0;
  }
  </code></pre>
  <p>I already know what is gonna be written in the output of the program, but my question is why?
  If you edit the string and make subtle changes, the output remains the same which is:</p>
  <pre><code>1:2
  2:4
  3:6
  </code></pre>