3 ms·
Thanks, so void* is the any type in C. And the argument is not necessarily a pointer nor should it be dereferenced. I think I understand.
by qprofyeh 4y ago
Thanks, so void* is the any type in C. And the argument is not necessarily a pointer nor should it be dereferenced. I think I understand.
- Warwolt 4y agoMore particularly, I would describe it as a "pointer to anything". The size of the value will be exactly the size used for pointers in the given system (e.g. 8 bytes). If you happen to know what a void* is pointing to, you can cast it to another type like "my_struct_t*" and deference the value. I would call it a work around for C lacking true polymorphism.
- quietbritishjim 4y agoThat is pretty much the opposite of what GP said: they're using void* to directly store an integer value rather than a pointer to anything (in that case).