title: Function insertionSort does not sort the array
body: <p>This is my code. After the call to the function <code>insertionSort</code>, when i print the array it prints the array without sorting it. </p>
  
  <p>I am unable to understand if the problem is in the sorting algorithm or some other problem. The code compiles just fine and runs too, so that excludes the probability of any syntactic errors.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void insertionSort(int arr[], int n);
  
  int main(){
    int n, i;
    printf("Enter n: ");
    scanf("%d\n", &amp;n);
    int arr[n];
    for(i=0; i&lt;n; i++){
      scanf("%d", &amp;arr[i]);
    }
  
    insertionSort(arr, n);
  
    for(i=0; i&lt;n; i++){
      printf("%d\n", arr[i]);
    }
  
  }
  
  void insertionSort(int arr[], int n){
    int i,j, key;
    for(j=1; j&lt;n; j++){
      key = arr[j];
      i = j-1;
      while (i&gt;0 &amp;&amp; arr[i] &gt; key) {
        arr[i+1] = arr[i];
        arr[i] = key;
        i--;
      }
    }
  }
  </code></pre>