Good afternoon. I've already read the doc for memcmp still I don't understand why in this function:
memcmp has a logical negation operator instead of being written:Code:static int match_int(const void *key1, const void *key2) {
/*****************************************************************************
* *
* Determine whether two integers match. *
* *
*****************************************************************************/
return !memcmp(key1, key2, sizeof (int));
}
for a function of a set like this:Code:
return memcmp(key1, key2, sizeof(int));
Code:
int set_is_member(const Set *set, const void *data) {
ListElmt *member;
/*****************************************************************************
* *
* Determine if the data is a member of the set. *
* *
*****************************************************************************/
for (member = list_head(set); member != NULL; member = list_next(member)) {
if (set->match(data, list_data(member)))
return 1;
}
return 0;
}