Find pointer size
2 answers
You are currently trying to figure out the size, which is at void. If you want to find the size of a void pointer try: sizeof (void *).
printf("pointer: %zu\n", sizeof(void*));
should do what you want. Use% zu, not% d, as the pointer is an unsigned value, not a decimal value.
Edit: Is there something else that I just thought of the first time around depends on the% zu compiler? Do I need to do something differently on a 32-bit or 64-bit architecture?
+9
a source to share