title: Use of second for loop in Bubble sort
body: <p>Can someone please explain the exact purpose of the second for loop in the following bubble sort? I understand the first loop is looking at the 'i'th integer of the array, but what exactly is the second for loop looking at?</p>
  
  <p>Please excuse my ignorance on the topic. I've been coding for less than a week now and am somewhat confused on the subject.</p>
  
  <pre><code>void sort(int array[], int size) {
    for(int i = 0, x = size - 1; i &lt; x; i++) {
      for(int j = 0; j &lt; x - 1; j++) {
        if(array[j] &gt; array[j + 1]) {
          int tmp = array[j];
          array[j] = array[j + 1];
          array[j + 1] = tmp;
        }
      }
    }
  }
  </code></pre>