title: invalid conversion from void* to void(*)(void*)[-fpermissive]
body: <p>this question was asked in relation to threads, but I have a simpler case.(beginner)<br>
  I tried the code in different compilers for c++ but would not work.<br>
  please advise how to replace the line:   <code>callback = (void*)myfunc;</code> //--> <code>error</code>   </p>
  
  <pre><code>typedef struct _MyMsg {
          int appId;
          char msgbody[32];
  } MyMsg;    
  void myfunc(MyMsg *msg)
  {
          if (strlen(msg-&gt;msgbody) &gt; 0 )
                  printf("App Id = %d \n Msg = %s \n",msg-&gt;appId, msg-&gt;msgbody);
          else
                  printf("App Id = %d \n Msg = No Msg\n",msg-&gt;appId);
  }    
  /*
   * Prototype declaration
   */
  void (*callback)(void *);    
  int main(void)
  {
          MyMsg msg1;
          msg1.appId = 100;
          strcpy(msg1.msgbody, "This is a test\n");    
          /*
           * Assign the address of the function 'myfunc' to the function
           * pointer 'callback'
           */                 
  //line throws error: invalid conversion from void* to void(*)(void*)[-fpermissive]    
          callback = (void*)myfunc; //--&gt; error               
          /*
           * Call the function
           */
          callback((MyMsg*)&amp;msg1);    
          return 0;
  }
  </code></pre>