It is useful to remember that in a 64-bit system, a pointer is a 64-bit value [memory address.]
int is just a 32-bit value, no matter what architecture you are in. Each time you try to assign a 64-bit value to a 32-bit value without casting it explicitly, the compiler will generate a warning [provided, it can still work, but overall this is not good practice.]
If you don't mind using unsigned integers, it might be easier to use uint_64t or something like that, which will avoid assignment from 64-bit and 32-bit (uint_64t is an unsigned 64-bit int)
Hope this helps.
One thing you can do is:
int key = 3; int value = 5; insert(t, (void *) &key, (void *) &value); printf("[%d]->[%d]\n", (int) *(t->key), (int) *(t->value));
However, be very careful when doing such things. It is not possible to know exactly what value is stored by this pointer unless you can guarantee that you will set the pointer and the value / type does not change. Unless you add an enumeration field or something that stores the type of value stored in the pointer's location, but this view defeats the target.
source share