Bubble Sort using pointers to function
问题 I'm trying to implement a bubble sort in c by using pointers to function but does not work. Can anyone help me? Here is the code: #include <stdio.h> #include <stdlib.h> void bubbleSort(void** base, size_t length, int (*compar)(const void*, const void*)); int main(int argc, char* argv[]) { int cmp(const void*, const void*); int vet[] = {1, 2, 5, 7, 6, 1, 3, 2, 9, 15, 14, 20}; bubbleSort((void**) &vet, sizeof(vet)/sizeof(vet[0]), cmp); int i; for (i = 0; i < sizeof(vet)/sizeof(vet[0]); i++) {