title: Seeing if Two Strings are Anagrams [C++]
body: <p>I am to write a program that will take 2 strings, put them into a function called "build_histogram" and build a int array that keeps count of how many times each letter appears in each string, then compare the arrays and if they are equal, then they are anagrams. The instructions state we are to ignore all symbols(ex. !, whitespaces, _, etc.) and it is not to be case sensitive.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cctype&gt;
  using namespace std;
  
  void build_histogram(int letters[], string s) {
  
     for(int i = 0; i &lt; s.length(); i++) {
        letters[s[i]]++;
     }
  }
  
  
  int main()
  {
      string s1, s2;
      int* histogram1[26];
      int* histogram2[26];
  
      cout &lt;&lt; "Enter two strings." &lt;&lt; endl;
      getline(cin, s1);
      getline(cin, s2);
  
      build_histogram(histogram1[26], s1);
      build_histogram(histogram2[26], s2);
  
     if(histogram1 != histogram2) {
        cout &lt;&lt; "They are not anagrams." &lt;&lt; endl;
     }
     else {
        cout &lt;&lt; "They are anagrams!" &lt;&lt; endl;
     }
  
      return 0;
  }
  </code></pre>
  
  <p>This is what I have so far, but no matter what strings I enter, I cannot get the program to print anything besides "Enter two strings."</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So this is my code now...it counts the number of characters correctly in each string, the only issue now is the "if else" statement at the bottom still doesn't recognize that the arrays are the same, also it's having a hard time when symbols like '!' are in the strings.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cctype&gt;
  using namespace std;
  
  void build_histogram(int letters[], string s) {
  
     for(int i = 0; i &lt; s.length(); i++) {
        char currLetter = s[i];
        currLetter = tolower(currLetter);
  
        int index = currLetter - 97;
        letters[index]++;
     }
  }
  
  
  int main()
  {
      string s1, s2;
      int histogram1[26] = {0};
      int histogram2[26] = {0};
  
      cout &lt;&lt; "Enter two strings." &lt;&lt; endl;
      getline(cin, s1);
      getline(cin, s2);
  
      build_histogram(histogram1, s1);
      build_histogram(histogram2, s2);
  
  
     if (histogram1 == histogram2) {
         cout &lt;&lt; "They are not anagrams." &lt;&lt; endl;
     } else {
         cout &lt;&lt; "They are anagrams!" &lt;&lt; endl;
     }
  
      return 0;
  }
  </code></pre>