Array sort with function pointer