Hacker News new | ask | show | jobs
by mnaydin 2667 days ago
A modern compiler would warn about the condition (ii >= 0) being always true.

One correct way would be

  for (size_t i = len; i > 0; --i) {
     // use i-1 as the array index
  }
or,

  size_t i = len
  while (i-- > 0) {
    // use i as the array index
  }