title: NOT(~) vs NEGATION(!)
body: <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  int main(int argc, char *argv[]) 
  {
     int i=-5;
     while(~(i))
     {
        cout&lt;&lt;i;
        ++i;
     }
  
   }
  </code></pre>
  
  <p>The output is -5,-4,-3,-2.
  Shouldn't it print values till -1?Why is it only till -2.
  And please explain me the difference between 'not' and 'negation' operators.When ever I write a program they were the source for bugs.</p>
  
  <pre><code>while(i)
  </code></pre>
  
  <p>I know that the loop condition will be true for positive and negative i's except 0.</p>
  
  <pre><code>while(!i) vs while(~i)
  </code></pre>
  
  <p>For what values of 'i' the above two loops get executed?</p>