23 lines
556 B
C
23 lines
556 B
C
#define __STDC_WANT_LIB_EXT1__ 1
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
char *CharVect[] = { "last", "middle", "first" };
|
|
|
|
int compare( const void *op1, const void *op2, void *context )
|
|
{
|
|
const char **p1 = (const char **) op1;
|
|
const char **p2 = (const char **) op2;
|
|
return( strcmp( *p1, *p2 ) );
|
|
}
|
|
|
|
void main()
|
|
{
|
|
void * context = NULL;
|
|
qsort_s( CharVect, sizeof(CharVect)/sizeof(char *),
|
|
sizeof(char *), compare, context );
|
|
printf( "%s %s %s\n",
|
|
CharVect[0], CharVect[1], CharVect[2] );
|
|
}
|