title: What Does the Bitwise Complement Function Do in a For Loop in C++?
body: <p>Take this line of code for example:
  <code>for(int i=n-1; ~i; --i)</code>
  My question is what does the <code>~i</code> mean. What I already know is the for loops needs the following:</p>
  
  <pre><code>for (type var = ; condition; something to do with var) {
  code here
  }
  </code></pre>
  
  <p>But how is <code>~i</code> a condition?
  All I know is <code>~i</code> returns the bitwise complement of <code>i</code>, or flip the bits.</p>