title: Counting most frequent character in a string
body: <p>I have a complex <code>C</code> program, and i wanna write only a function which gets a string as a parameter. </p>
  
  <pre><code>int most_frequent(char *string)
  </code></pre>
  
  <p>The function has to return the number of the most frequent character in the string. I tried something like this, but this is incorrect i think:</p>
  
  <pre><code> int most_frequent(char *string){
       int i, lenght;
       lenght=strlen(string);
       int max=0, x=0;
       for(i=0;i&lt;lenght;i++)
       {
           if(string[i]==string[i++])
           {
               x++;
           }
           if(max&lt;x)
               max=x;
       }
       return max;
   }
  </code></pre>
  
  <p>for example: "overflow" - 2
               "eleven" - 3</p>