1Simple Introduction to FunctionsFunction: Sort by using high-speed sort routinesHeader file: stdlib.hUsage: void qsort (void *base,int nelem,int Width,int (*fcmp) (const void *,const void *));Number of references: 1 The first address of the array
one, qsort () functionPrototype: _crtimp void __cdecl qsort (void*, size_t, Size_t,int (*) (const void*, const void*));Parameter explanation: 1, the first address of the array to be sorted, 2, the number of elements to be sorted in the array, 3, the
First, explain qsort and sort. They can only sort the data in the continuous memory. structures like linked lists cannot be sorted.
First, qsort
Qsort, and unstable ). The qsort function integrated in the C language library function uses a three-way
Qsort () should be a fast sort. It seems that data is moved in blocks, which is faster.
Prototype:_ Cribd void _ cdecl qsort (void *, size_t, size_t, INT (*) (const void *, const void *));
Explanation: qsort (array name, number of elements,
In ANSI C, the prototype of the Qsort function is
#include
void Qsort (void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *));
Explanation: The Qsort function sorts an array containing nmemb elements,
Next, let's explain qsort and sort in detail and try again! (Note the writing of comparison functions of qsort and sort, which is prone to errors)
First qsortThe basic quick sorting method divides an array into two points and one score in the middle
Original: http://www.cnblogs.com/ForeverJoker/archive/2013/05/25/qsort-sort.htmlLet's start by explaining Qsort and sort, which can only be sorted on contiguous memory data, such as a list of structures that can't be sorted.First of all, qsort.Qsort
1.qsort function:Primitive : void qsort (void *base, int nelem, int width, int (*fcmp) (const void *,const void *)); power : sorting using a quick sort routineParameters1 array first address to sort2 number of elements to be sorted in the array3
Reprinted from http://blog.csdn.net/yzl_rex/article/details/7874513
Next, let's explain qsort and sort in detail and try again! (Note the writing of comparison functions of qsort and sort, which is prone to errors)
First qsortThe basic quick sorting
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.