title: C cast void * to type_t
body: <p>I have following code from an object-oriented programming C book:</p>
  
  <pre><code>{
    struct Set { int count; };
  
    struct Set * set =  malloc(sizeof(struct Set));
    void * p = set;
  
    const size_t size = * (const size_t *) p;
  }
  </code></pre>
  
  <p>I cant understand how and why last line works. <code>size_t size</code> is dereferenced value of pointer of type <code>size_t</code>. pointer of type type_t is cast from <code>void* p</code>.
  What is happening when I cast <code>void*</code> to <code>type_t*</code>, I could not find any information in the book or online tutorials. Can someone explain it to me or refer me to a good tutorial?</p>