my code's not working. The idea was to make a function which would bubble swap a generic array but i don't know why it's not working if i could get some help it would be appreciated.
int compareInt(int *a, int *b){
return (*a)-(*b);
}
void swap(void *a, void *b){
void *aux;
aux=a;
a=b;
b=aux;
}
void bubbleSort(void *v1, size_t dim, size_t bytes, int (*cmp)(void *, void *)){
int i, j;
for(i=0; i<dim1; i++)
for(j=0;j<dim1-1-i; j++){
if(cmp(v1+j*bytes, v1+(j+1)*bytes)>0)
swap(v1+j*bytes, v1+(j+1)*bytes);
}
}
void printVec(int *v1, int dim){
int i;
for(i=0; i<dim; i++)
printf("%d ",v1[i]);
printf("\n");
}
int main (void){
int v1[]={7,3,5,1,9,2};
printVec(v1, 6);
bubbleSort(v1, 6, sizeof(int), compareInt);
printVec(v1,6);
return 0;
}