you can't deref a void pointer because you can't tell the bounds of the memory address without knowing the size of the data type.
you can return void pointers from a function and use them. Obvious in hindsight but a function that returns void does return a value you just don't usually use them.
void return values are different from void* though. void * is still a pointer. the cast is just you telling the compiler what the data type is and thus how to get it.
I think the * operator is doing a bit too much tbh. Having different tokens for dereference and declaring a pointer type would make the code easier to read.
assigning a void ptr to a typed ptr will automatically cast the void ptr to that type. if the deref value is of a different type na wetin your eye see you go see. The compiler will not check for you.
pointers do not get initialized to NULL by default.
a freed pointer can still be dereferenced. all free does is mark the memory available for allocation. if you deref am na wetin your eye see you go see.
why is a pointer 8 bytes long?
8 bits make a byte. 8 bytes would contain 8 * 8 bits. 64 bits. on a 64 bit architecture the largest address would be representable by 64 bits. which require 8 bytes to store.
A pointer is a data type that stores a memory address.
A pointer is a data type that stores a memory address.