title: Sort set of array in ascending order in C++
body: <p>I'm trying to write a code to actually sort my array in an ascending order, so what happen is that say this is what I have.</p>
  
  <pre><code>char myListArray[10][40];
  myListArray = "Yeah?",
                "Tomorrow",
                "Again",
                "I will see you";
  </code></pre>
  
  <p>So what happen is that it should be sort in the order by ASCII value.</p>
  
  <pre><code>Again
  I will see you
  Tomorrow
  Yeah?
  </code></pre>
  
  <p>I've create something like this...</p>
  
  <pre><code>char temp[40];
  temp[0] = '\0';           
  int i, j, pos = 10, flag = 1;
  
  for(i = 1; (i &lt;= pos) &amp;&amp; flag; i++)
  {
      flag = 0;
      for (j=0; j &lt; (pos -1); j++)
      {
          if (phrase[i][j+1] &gt; phrase[i][j])     
          {
              strcpy(temp, phrase[i]);
              strcpy(phrase[i], phrase[i+1]);
              strcpy(phrase[i+1], temp);
              flag = 1;
          }
      }
  }
  </code></pre>
  
  <p>Now I don't know I have a problem with my logic, and I wish to know if there is a function to sort easy way? or <code>bubble sort</code> is the easiest ?</p>
  
  <p>UPDATE:</p>
  
  <p>I will accept one of the answer below, but I have found my solution of how to sort my array in the easiest way.</p>
  
  <pre><code>while(pos &lt; 9){
  
    if(phrase[pos][i] &gt; phrase[pos+1][i]){
  
  
     strcpy(temp, phrase[pos]);
     strcpy(phrase[pos], phrase[pos+1]);
     strcpy(phrase[pos+1], temp);
     flag = 1;
  
   if(flag = 1){
  
      pos = 0;
  
    }
  
  
    }
  
  pos++;
  
  }
  </code></pre>