The type of `val` is `int **`, and it will work with tsearch() anyway because of implicit cast from `void *`, so declaring it as an `int **` simplifies the code. Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> --- man3/tsearch.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man3/tsearch.3 b/man3/tsearch.3 index 2e8403130..7b82d9bd3 100644 --- a/man3/tsearch.3 +++ b/man3/tsearch.3 @@ -323,7 +323,7 @@ action(const void *nodep, VISIT which, int depth) int main(void) { - void *val; + int **val; srand(time(NULL)); for (int i = 0; i < 12; i++) { @@ -332,7 +332,7 @@ main(void) val = tsearch((void *) ptr, &root, compare); if (val == NULL) exit(EXIT_FAILURE); - else if ((*(int **) val) != ptr) + else if (*val != ptr) free(ptr); } twalk(root, action); -- 2.28.0