title: typecast struct pointer into char pointer reference
body: <p>Is it possible to typecast struct pointer into char pointer reference? I know that we can cast any pointer type to any other pointer type. But I got an error when I tried to typecast structure. I am using C++ compiler. </p>
  
  <p>Error :<br>
      error: invalid initialization of non-const reference of type 'char*&amp;' from a temporary of type 'char*'</p>
  
  <p>Please see below example:</p>
  
  <pre><code>struct test {
      int a;
      bool y;
      char buf[0];
  }
  
  struct test *x_p = NULL;
  
  char *p = "Some random data......";   // this can be more than 64 bytes
  
  x_p = (struct test *) malloc(sizeof(struct test) + 65);
  x_p-&gt;a = 10;
  x_p-&gt;y = false;
  memcpy(x_p-&gt;buf, p, 64); //copy first 64 bytes
  
  /* Here I am getting an error : 
   * error: invalid initialization of non-const reference of type 'char*&amp;' from a temporary of type 'char*'
   */
  
  call_test_fun((char *)x_p);
  
  // Function Declaration 
  
  err_t call_test_fun(char *&amp; data);
  </code></pre>