1. Salem's compare() function does most of the work: it sorts with respect to the second column only. If you write a compare function that sorts in a "first column, second column way" than qsort() will work for you as well. You can also write a function that checks whether an array is already sorted by looping through it and returning an appropriate value before you start the algorithm.
2, int (*a)[2] is a pointer to an array of two integers, iirc.