title: 2D String Array Bubble Sort
body: <p>I am trying to figure out how to bubble sort a 2D string array. I am currently stuck trying to figure out why my program isnt sorting the strings. I spsupect it could be possible that something is wrong with void swap. I feel somehting with the 2D array needs to be put in there. I am not very sure I just learned how to create bubble sorting algorithms. </p>
  
  <p>#include </p>
  
  <pre><code>using namespace std;
  
    const int SIZE = 2;
    const int ROWS = 2;
  
  void bubbleSort(string values[][SIZE]);
  void swap(int &amp;, int &amp;);
  
  int main ()
  
  {
  
  
  
      string values[ROWS][SIZE] = {{"A23", "A12"}, {"name1", "name2"}};
  
      cout &lt;&lt; "Unsorted Values: " &lt;&lt; endl;
  
  
      for(auto element : values)
          cout &lt;&lt; element &lt;&lt; " ";
  
      cout &lt;&lt; endl;
  
      cout &lt;&lt; "Sorted Values" &lt;&lt; endl;
  
           bubbleSort(values);
              for (auto element:values)
  
          cout &lt;&lt; element &lt;&lt; " ";
  
      return 0;
  
  }
  
  void bubbleSort(string values[][SIZE])
  {
      int maxElement;
      int index;
  
      for (maxElement = SIZE - 1; maxElement &gt; 0; maxElement--)
      {
          for( index = 0; index &lt; maxElement; index++)
          {
              if (values[0][index] &gt; values[0][index + 1])
              {
                  swap(values[0][index], values[0][index + 1]);
              }
          }
      }
  }
  
  void swap(int &amp;a, int &amp;b)
  {
      int temp = a;
      a = b;
      b = temp;
  }
  </code></pre>