How to index arrays using pointers safely
<p><strong>Edit: If you fundamentally disagree with the Fedora guide here, please explain why this approach would be worse in an objective way than classic loops. As far as I know even the CERT standard doesn't make any statement on using index variables over pointers.</strong></p>

<p>I'm currently reading the <a href="https://docs.fedoraproject.org/en-US/Fedora_Security_Team/1/html/Defensive_Coding/chap-Defensive_Coding-C.html#sect-Defensive_Coding-C-Pointers" rel="nofollow noreferrer">Fedora Defensive Coding Guide</a> and it suggests the following: </p>

<blockquote>
  <p>Always keep track of the size of the array you are working with.
  Often, code is more obviously correct when you keep a pointer past the
  last element of the array, and calculate the number of remaining
  elements by substracting the current position from that pointer. The
  alternative, updating a separate variable every time when the position
  is advanced, is usually less obviously correct.</p>
</blockquote>

<p>This means for a given array</p>

<pre><code>int numbers[] = {1, 2, 3, 4, 5};
</code></pre>

<p>I should not use the classic </p>

<pre><code>size_t length = 5;
for (size_t i = 0; i &lt; length; ++i) {
    printf("%d ", numbers[i]);
}
</code></pre>

<p>but instead this:</p>

<pre><code>int *end = numbers + 5;
for (int *start = numbers; start &lt; end; ++start) {
    printf("%d ", *start);
}
</code></pre>

<p>or this:</p>

<pre><code>int *start = numbers;
int *end = numbers + 5;
while (start &lt; end) {
    printf("%d ", *start++);
}
</code></pre>

<ol>
<li>Is my understanding the recommendation correct?</li>
<li>Is my implementation correct?</li>
<li>Which of the last 2 is safer?</li>
</ol>