Setting the first two bytes of a block of memory

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:43 UTC
Read the original article Hit count: 240

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 of the block as NULL or have it point somewhere? I do not want to simply assign 'block' to NULL or to another pointer because I want to access the rest of the memory I malloc'ed.

© Stack Overflow or respective owner

Related posts about c

    Related posts about pointers