Finding the most frequent character in a string This is in C/C++ (using a c-string as input). I'm curious if my solution could be more efficient than it currently is.

char mostFrequent(char *bytes, int length) {
  char holder[26];
  for (int i = 0; i &lt; 26; i++) {
    holder[i] = 0;
  }

  for (int i = 0; i &lt; length; i++) {
    holder[bytes[i]-97] += 1;
  }

  char b = 97; // a
  int count = holder[0];
  for (int i = 1; i &lt; 26; i++) {
    if (holder[i] &gt; count) {
      count = holder[i];
      b = i+97;
    }
  }

  return b;
}
If you are intended to measure the frequency of bytes, as the name of your input string seems to suggest, rather than just lowercase ASCII letters, then your holder array should be 256 elements long. 

This also saves you from all the additions and subtractions of the 'magic' number 97. (Seriously, you could have used 'a'.) 

Also, your holder array should consist of ints not chars, because if a certain byte appears more than 256 times in your input string the char will wrap around to zero. Also an array of ints will probably perform more efficiently due to memory alignment.