什么是回调函数?
的有关信息介绍如下:typedef int (__stdcall *CompareFunction)(const byte*,const byte*);//回调函数void DLLDIR __stdcall Bubblesor(byte* array,int size,int elem_size,CompareFunction cmpFunc); void DLLDIR __stdcall Quicksort(byte* array,int size,int elem_size,CompareFunction cmpFunc); void DLLDIR __stdcall Bubblesort(byte* array,int size,int elem_size,CompareFunction cmpFunc) { for(int i=0; i < size; i++) { for(int j=0; j < size-i-1; j++) { //回调比较函数if(1 == (*cmpFunc)(array+j*elem_size,array+(j+1)*elem_size)) { //两个相比较的元素相交换 byte* temp = new byte[elem_size]; memcpy(temp,array+j*elem_size,elem_size); memcpy(array+j*elem_size,array+(j+1)*elem_size,elem_size); memcpy(array+(j+1)*elem_size,temp,elem_size); delete [] temp; } } } }