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 Answer 1
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
- The Overflow Blog
-
-
- Featured on Meta
-
-
-
Related
Hot Network Questions
- Button naming convention for web app buttons that open view/edit modals
- Comparison between Faltings height and naive height of a curve
- Source for the GR"A holding that a Mil is 22.5 minutes long?
- Approximating reciprocal of polynomial by polynomial on specific interval
- Can I use a smart plug to disable a gas boiler at night?
- Can the Universe stop expanding?
- Plane accelerate in stationary air vs stationary plane in accelerating airflow?
- How do I fix the "turned off for managed browsers" error when trying to enable secure DNS in Edge?
- What was the main point of disagreement between Bergson and Einstein?
- At what level should the three electrodes of a floatless level switch be positioned for water level controller system?
- Does the Carbon Snake demonstration produce Graphite?
- Why does D.J. translate "liberate me" as "save me"?
- How to express a series of coughs when you have a cough?
- Which atmospheric simulation paper was Space Station 13 based on?
- In a stationary, asymptotically flat spacetime, when does a Killing horizon coincide with the event horizon?
- What actually creates impedance, or what increases the impedance of a system?
- Why does the Bond girl Rublevitch have a seemingly male name?
- floating point arithmetic and boolean operations with \ifthenelse
- What is the correct definition of a limit point in real analysis?
- Was 2023 the first time a person in California was killed in a black bear attack?
- Is this lighting bracket allowed and if not how best to fix it?
- Does the content of LUKS disks become encrypted again at unmount or at power-off
- News API in Python
- Continuous payment authority makes whole balance unavailable if not enough funds
lang-c
char *or more technically correct auint8_t *