The code would be better written as:
[compressed again -dM]
#include <limits.h>
void foo(char *s)
{ size_t charcount[-CHAR_MIN + CHAR_MAX];
memset(charcount,0,sizeof(charcount));
for ( ; *s ; s++) charcount[*s + -CHAR_MIN]++; }
Okay, class, now who can find the bug in _this_ version? (Yes, there
is one.)
Sigh. Off-by-one error in declaring the array.
-spc (Finally found it ... X-/