qsort function(Sort Array) in C Language – example and detail

In the C Programming Language, the qsort feature sorts the array pointed to with the aid of base.

Syntax

The syntax for the qsort feature in the C Language is:

void qsort(void *base, size_t num_members, size_t size, 
           int (*compare_function) (const void *, const void *));

Parameters or Arguments

base The array to sort. num_members The wide variety of factors in the array. size The measurement of the elements in bytes. compare_function A pointer to a evaluation function.

Returns

The qsort feature returns a negative, zero, or high-quality integer (based on whether or not the first thing in the array is less than, equal to, or greater than the 2d issue in the array).

Required Header

In the C Language, the required header for the qsort function is:

#include <stdlib.h>

Applies To

In the C Language, the qsort function can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C features that are comparable to the qsort function:

bsearch function <stdlib.h>