Sorting algorithms in functionnal programming in C