title: Passing an array as a function parameter in C++
body: <p>In C++, arrays cannot be passed simply as parameters. Meaning if I create a function like so:</p>
  
  <pre><code>void doSomething(char charArray[])
  {
      // if I want the array size
      int size = sizeof(charArray);
      // NO GOOD, will always get 4 (as in 4 bytes in the pointer)
  }
  </code></pre>
  
  <p>I have no way of knowing how big the array is, since I have only a pointer to the array.</p>
  
  <p>Which way do I have, without changing the method signature, to get the size of the array and iterate over it's data?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong> just an addition regarding the solution. If the char array, specifically, was initialized like so:</p>
  
  <pre><code>char charArray[] = "i am a string";
  </code></pre>
  
  <p>then the <code>\0</code> is already appended to the end of the array. In this case the answer (marked as accepted) works out of the box, so to speak.</p>