String-to-char array conversion:
String str ("Please split this sentence into tokens");
char * CStr = new char [Str.length () +1];
strcpy (CStr, Str.c_str());
Quick Sort Qsort function
Need to include <stdlib.h> qsort
Features: Sorting using the quick sort routines
Usage: void qsort (void *base, int nelem, int width, int (*fcmp) (const void *,const void *));
Each parameter
1 array first address to sort
2 number of elements to be sorted in the array
3 space size of each element
4 pointers to functions
First, sort an array of type int
int cmp (const void *a, const void *b) {return * (int *) A-* (int *) b;} Qsort (Num,100,sizeof (num[0]), CMP);
Second, sort the array of char types (same as int type)
int cmp (const void *a, const void *b) {return * (char *) A-* (int *) b;} Qsort (Word,100,sizeof (word[0]), CMP);
Third, sort the array of double types (especially note)
int cmp (const void *a, const void *b) {return * (double *) a > * (double *) b? 1:-1;} Qsort (In,100,sizeof (in[0]), CMP);
Iv. Array of strings
int Compare_c (const void *a,const void *b) {return strcmp ((char*) A, (char*) b);} Qsort (F,n,16,compare_c);
C + + practical syntax