title: Convert a string into a char array
body: <p>New to C++ and So here is part of a project I'm working on, taking a string and printing the most commonly used number along with how many times it was used. i thought this was right, but for some reason my char array wont be read in. any tips or suggestions on how to fix?</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  char getMostFreqLetter(string ss);
  
  int main() {
      string s; //initilizing a variable for string s
      s = ("What is the most common letter in this string "); // giving s a string
  
      getMostFreqLetter(s); // caling the function to print out the most freq Letter
  
      return 0;
  }
  
  char getMostFreqLetter(string ss) {
      int max, index, i = 0;
      int array[255] = {0};
      char letters[];
  
      // convert all letters to lowercase to make counting letters non case sensative
      for (int i = 0; i &lt; ss.length(); i ++){
          ss[i] = tolower(ss[i]);
      }
  
      //read each letter into
      for (int i = 0; i &lt; ss.length(); i ++){
          ++array[letters[i]];
      }
      //
  
      max = array[0];
      index = 0;
      for (int i = 0; i &lt; ss.length(); i ++){
          if( array[i] &gt; max)
          {
              max = array[i];
              index = i;
          }
      }
  
      return 0;
  }
  </code></pre>