title: count empty char cells c++
body: <p>For goodness' sake, it's seems such a simple piece of code and I just can't figure out where I went wrong.</p>
  
  <pre><code>int count = 0;
   for (int i = 0; i&lt;10;i++){
      if (chararray[i]=='\0' &amp;&amp; i == 0){
          cout &lt;&lt; "Empty \n";
          break;
      }
      if (chararray[i]!='\0') {
          count = count ++;
      }
   }
  cout &lt;&lt; "Deleted " &lt;&lt; count &lt;&lt; "elements \n";
  </code></pre>
  
  <p>So the basic idea is that it goes through the array and if it's empty, then returns "Empty" and if not then it counts all the non empty cells and returns how many of them there were. If it makes any difference, I'm putting this under deconstructor method.</p>
  
  <p>Generally it works fine, <em>it just won't COUNT right.</em> It either counts all or none.</p>
  
  <hr>
  
  <p>UPDATE!</p>
  
  <p>Thank you all! I removed the <code>count = count++</code> line with <code>++count</code> and it displayed more correct results than before, but not for all test values (and I promise not to make this same mistake again). As it is, I took the advice to use <code>strlen</code> function as there isn't a specific need for a 0 in place of, well, nothing. Also it made the code much, much shorter. Thank you!</p>