title: Size of an Array.... in C/C++?
body: <p>Okay so you have and array A[]... that is passed to you in some function say with the following function prototype:</p>
  
  <pre><code>void foo(int A[]);
  </code></pre>
  
  <p>Okay, as you know it's kind of hard to find the size of that array without knowing some sort of ending variable or knowing the size already...</p>
  
  <p>Well here is the deal though. I have seem some people figure it out on a challenge problem, and I don't understand how they did it. I wasn't able to see their source code of course, that is why I am here asking.</p>
  
  <p>Does anyone know how it would even be remotely possible to find the size of that array?? Maybe something like what the free() function does in C??</p>
  
  <p>What do you think of this??</p>
  
  <pre><code>template&lt;typename E, int size&gt;
  int ArrLength(E(&amp;)[size]){return size;}
  
  void main()
  {
      int arr[17];
      int sizeofArray = ArrLength(arr);
  }
  </code></pre>