title: Count number of chars in char array including spaces until null char
body: <p>I'm trying to count the number of chars in a char array including the space until the end of the string.</p>
  
  <p>The following compiles but doesn't return the correct value, I'm trying to use pointer arithmetic to interate through my array. </p>
  
  <pre><code>   int numberOfCharsInArray(char* array) {
         int numberOfChars = 0;
         while (array++ != '\0') {
             numberOfChars++;
         }
         return numberOfChars;
     }
  </code></pre>
  
  <p>Many thanks.</p>
  
  <p>Obviously I'm trying to get the equivalent of length() from cstring but using a simple char array.</p>
  
  <p>Of course if my original array wasn't null terminated this could cause a very big value to return (I guess).</p>