c - Determining index from bsearch and lfind? -
i'm trying index of element in array after lfind , bsearch return pointer element found. have far:
(char *) (found - cv->baseaddress);
where found address of functions found, , base address address of element 0. however, compiler gives me error:
cvector.c:150:28: warning: pointer of type ‘void *’ used in subtraction cvector.c:150:4: warning: return makes integer pointer without cast
what do?
you have typecast returned pointer correct type. need divide offset size of objects in array index.