title: How does the range-based for work for plain arrays?
body: <p>In C++11 you can use a range-based <code>for</code>, which acts as the <code>foreach</code> of other languages. It works even with plain C arrays:</p>
  
  <pre><code>int numbers[] = { 1, 2, 3, 4, 5 };
  for (int&amp; n : numbers) {
      n *= 2;
  }
  </code></pre>
  
  <p>How does it know when to stop? Does it only work with static arrays that have been declared in the same scope the <code>for</code> is used in? How would you use this <code>for</code> with dynamic arrays?</p>