Insertion Sort and its implementation in C

Insertion Sort is a simple implementation of the general straight selection sort. A simple routine for insertion sort can be written as below –

void insertionsort(int x[], int n){

    int i, k, y;

    /*It is assumed that X[0] is already sorted*/

    for(k = 1; k < n; k++){

       y = x[k];

       for(i = k-1; i> =0 && y < x[i]; i--)

          x[i+1] = x[i];

       x[i+1] = y; /*inserts y at proper position*/