### Function

# GLib ByteArray sort

#### Declaration

    void
    g_byte_array_sort (
      GByteArray* array,
      GCompareFunc compare_func
    )

#### Description

Sorts a byte array, using `compare_func` which should be a qsort()-style comparison function (returns less than zero for first arg is less than second arg, zero for equal, greater than zero if first arg is greater than second arg).

If two array elements compare equal, their order in the sorted array is undefined. If you want equal elements to keep their order (i.e. you want a stable sort) you can write a comparison function that, if two elements would otherwise compare equal, compares them by their addresses.

#### Parameters

`array`

  Type: An array of `guint8`

  A `GByteArray`.

  The data is owned by the caller of the function.

`compare_func`

  Type: `GCompareFunc`

  Comparison function.