Same as C, define a named function, and pass a pointer to the sorting function.
Unlike C you can stamp out a specialized and typesafe sort function via generics though:
https://ziglang.org/documentation/master/std/#std.sort.binar...
And what if you need to close over some local variable?
Unlike C you can stamp out a specialized and typesafe sort function via generics though:
https://ziglang.org/documentation/master/std/#std.sort.binar...