4

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 ?

1
  • 1
    Use a char * or more technically correct a uint8_t * Commented Dec 29, 2016 at 5:16

1 Answer 1

9

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.