-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQsort.cpp
54 lines (42 loc) · 964 Bytes
/
Qsort.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* =====================================================================================
*
* Filename: QsortZt.cpp
*
* Description:
*
* Version: 1.0
* Created: 2016年03月22日 10时51分49秒
* Last Modified: 2018-03-22 15:15:57
* Revision: none
* Compiler: gcc
*
* Author: zt (),
* Organization:
*
* =====================================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
uint32_t testArray[] =
{
66, 1, 333, 2, 4, 3, 7,
616, 2, 333, 21, 41, 13, 17,
};
int compare ( const void* a, const void* b )
{
return ( * ( uint32_t* ) a - * ( uint32_t* ) b );
}
#if 0
int main ( int argc, char* argv[] )
{
( void ) argc;
( void ) argv;
int n = 14;
qsort ( testArray, 14, sizeof ( uint32_t ), compare );
for ( int i = 0; i < n; ++i )
printf ( "%d ", testArray[i] );
return 0;
}
#endif