title: Can I assign void* pointer to char* pointer?
body: <p>I am coding for re-implementing <code>malloc</code> function. I saw a man's example code , which has some strange code like this</p>
  
  <pre><code>struct s_block{
     size_t size;    // size per block
     int free;       // whether free flag exist
     t_block pre;
     t_block next;
     void *magic_ptr;
     int padding;    // bytes for padding
     char data[1];   // first byte of data, i.e. the address returned from malloc
  };
  
  typedef struct s_block *t_block;
  t_block get_block(void *p) {
     char *tmp;  
     tmp = p;
     ...
  }
  </code></pre>
  
  <p>but I use gcc or g++ to compile this code, the error is "can't use void* pointer to char* pointer".
  I want to know where the question arise? gcc or g++ ? code is error?</p>