title: Sorting an array in C
body: <p>I'm trying to sort elements in an array from smallest to largest that a user inputs along with the size. This is my code so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  
  #define MAXVALUES 20
  
  void sort(int *A[], int n) {
      int i, tmp, j;
      for (i = 0; i &lt;= (n - 2); i++) {
          for (j = (i + 1); j &lt;= (n - 1); j++) {
              if (*A[i] &gt; *A[j]) {
                  tmp = *A[i];
                  *A[i] = *A[j];
                  *A[j] = tmp;
              }
          }
      }
      return;
  }
  
  int main(int argc, char *argv[]) {
      int n, A[MAXVALUES], i;
      printf("Enter an array and no. of elements in array: ");
      scanf("%d%d", &amp;A[MAXVALUES], &amp;n);
      sort(A[MAXVALUES], n);
      printf("Ordered array is: \n"); 
      for (i = 0; i &lt;= (n - 1); i++) {
          printf("  %d", A[i]);
      }
      return 0;
  }
  </code></pre>
  
  <p>The compiler compiles it without any errors but it stops working after I put in the inputs. I've yet to quite grasp the theory behind arrays and pointers so could someone tell me where in my code I'm going wrong?</p>