Here is a Quicksort example employing Pelles C run-time library :
include Sample.inc
CompareProc PROTO C :DWORD,:DWORD
NUMB_OF_ELEMENTS equ 10
.data
numbers dd 29,12,32,65,58,7,12,11,11,97
format1 db '%d',13,10,0
.code
start:
invoke qsort,ADDR numbers,\
NUMB_OF_ELEMENTS,\
SIZEOF DWORD,ADDR CompareProc
call PrintArray
invoke ExitProcess,0
CompareProc PROC C arg1:DWORD,arg2:DWORD
mov ecx,arg1
mov edx,arg2
mov eax,DWORD PTR [ecx]
sub eax,DWORD PTR [edx]
ret
CompareProc ENDP
PrintArray PROC uses esi ebx
mov ebx,NUMB_OF_ELEMENTS
mov esi,OFFSET numbers
@@:
invoke printf,ADDR format1,\
DWORD PTR [esi]
add esi,4
dec ebx
jnz @b
ret
PrintArray ENDP
END start