void list_sort (struct list *,
list_less_func *, void *aux);
typedef bool list_less_func (const struct list_elem *a,
const struct list_elem *b,
void *aux);
static bool less_list(const struct list_elem* ewc1,
const struct list_elem* ewc2, void* aux) {
/* TODO */
bool comparefunc=list_less_func(const struct list_elem* ewc1, const struct list_elem* ewc2, void* aux);
if (comparefunc)
return false;
else
return true;
}
void wordcount_sort(word_count_list_t* wclist,
bool less(const word_count_t*, const word_count_t*)) {
list_sort(&wclist->lst, less_list, less);
}
对函数typedef不太熟悉,求指点,问题如下:comparfunc那块出错了,谢谢!
word_count_p.c:105:22: error: expected expression before ‘list_less_func’
bool comparefunc=list_less_func(const struct list_elem* ewc1, const struct list_elem* ewc2, void* aux);
^~~~~~~~~~~~~~