Iterating Backwards in C

This is shorter than some of my other posts, but I keep seeing people doing this wrong. It's even worse now in the LLM era.

Let's say you have a buffer and a counter and you need to iterate it backwards for some reason:

_Bool find_last(size_t count, int *haystack,
                int needle, size_t *where);

Almost everyone can do the forward version on autopilot:

for(size_t i = 0; i < count; i++){
  if(haystack[i] == needle){
    *where = i;
    return 1;
  }
}
return 0;

So they try to do the same thing, just iterating backwards:

for(size_t i = count - 1; i >= 0; i--){
  // find needle
}