Setting the first two bytes of a block of memory as a pointer or NULL while still accessing the rest

Posted by idealistikz on Stack Overflow See other posts from Stack Overflow or by idealistikz
Published on 2010-04-27T18:39:13Z Indexed on 2010/04/27 18:53 UTC
Read the original article Hit count: 177

Filed under:
|

Suppose I have a block of memory as such:

void *block = malloc(sizeof(void *) + size);

How do I set the first two bytes to a pointer or NULL while still being able to access the rest of the block of memory? For this reason, I do not want to simply assign 'block' to another pointer or NULL.

© Stack Overflow or respective owner

Related posts about c

    Related posts about pointers