C Tutorial/stdlib.h/qsort — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 13:32, 25 мая 2010

qsort

Item Value Header file stdlib.h Declaration void qsort(void *buf, size_t num, size_t size, int (*compare) (const void *, const void *)); Function sorts the array *buf using a Quicksort. Parameter The number of elements in the array is specified by num, and the size (in bytes) of each element is described by size.

The function pointed to by compare is used to compare two elements of the array.

The form of the compare function must be as follows:


<source lang="cpp">int func_name(const void *arg1, const void *arg2);</source>