Is it possible to dereference a void pointer without a cast knowing(during execution) the size of the item located in memory ? Or, if not possible with a void pointer, how can I access a specific memory address(located in the heap) and read an only-known during execution specific number of bytes ?
With a char *
which basically points to a byte size of memory you can access all the bytes of any datatype.
And you can also cast a void *
to necessary type and deference it to get the correct dereferenced value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With