quick sort problem
Posted
by farka
on Stack Overflow
See other posts from Stack Overflow
or by farka
Published on 2010-06-11T11:57:14Z
Indexed on
2010/06/11
12:02 UTC
Read the original article
Hit count: 198
Filed under:
c
I use qsort from C libary and I have datatype
Element_type **pElement and Element_type is struct typedef element_type {int ,char ....}
example, and i call quicksor function with
qsort(*pElement,iCountElement,(size_t)sizeof(Element_type),compare);
and callback function
static int compare(const void *p1, const void *p2) {
Element_type *a1 = (Element_type *)p1;
Element_type *a2 = (Element_type *)p2;
return ( (a2)->iServiceId < (a1)->iServiceId );
}
but I always get segmentation fault. Why?
© Stack Overflow or respective owner