title: Array changed in a void function, is still changed outside! why? (scope)
body: <p>This is a simple implementation of a sort algorithm. My question is. The array <code>numbers</code>, is declared and initialized in main. Then, I pass it like an argument in the function <code>sort</code> (Is a copy ?). Inside the <code>sort</code> function, <code>numbers</code>, now called <code>array</code> (a copy, as far as I know), is changed (sorted). So, why, after calling the function, the array <code>numbers</code> is changed (this is what I want, buy want to know why??. <code>array</code> scope is in <code>sort</code>, not <code>main</code>.</p>
  
  <pre><code>int main(void)
  {
      int numbers[SIZE] = { 4, 15, 16, 50, 8, 23, 42, 108 };
      for (int i = 0; i &lt; SIZE; i++)
          printf("%d ", numbers[i]);
      printf("\n");
  
      sort(numbers, SIZE);
  
      for (int i = 0; i &lt; SIZE; i++)
          printf("%d ", numbers[i]);
      printf("\n");
      return 0;
  }
  void sort(int array[], int size)
  {
      int swaps = 0;
  
      while(swaps==0)
      {
          for(int i = 0; i &lt; size ; i++)
          {
              for(int j = i + 1; j &lt; size ; j++)
              {
                  if( array[i] &gt; array[j] )
                  {
                      // Swapping
                      int temp = array[i]; 
                      array[i] = array[j];
                      array[j] = temp;
  
                      swaps ++;
                  }   
              }
          }
      }    
  }
  </code></pre>