void swap(void *x, void*y, int size){
char *buf = malloc(size);
memcpy(buf, x, size);
memcpy(x, y, size);
memcpy(y, buffrer, size);
free(buf);
}
void * lsearch(void *base, void *key, int n, int elemsize){
for(int i = 0; i
void *elemaddr = (char*)base + i*elemsize;
if(memcmp(elemaddr, key, elemsize) == 0){
return elemaddr;
}
}
return NULL;
}
阅读(1123) | 评论(0) | 转发(0) |