title: C++ getting error C2440
body: <p>Hello I'm using Visual Studio c++ 2010</p>
  
  <p>I'm having a problem with this code ( it's taken from C language code ) :</p>
  
  <pre><code>MEMBLOCK* create_memblock (HANDLE hProc,  MEMORY_BASIC_INFORMATION *meminfo)
  {
  
      MEMBLOCK *mb = malloc(sizeof(MEMBLOCK));
  
      if (mb)
      {
          mb-&gt;hProc = hProc;
          mb-&gt;addr = meminfo-&gt;BaseAddress;
          mb-&gt;size = meminfo-&gt;RegionSize;
          mb-&gt;buffer = malloc(meminfo-&gt;RegionSize);
          mb-&gt;next = NULL;
  
      }
      return mb;
  }
  </code></pre>
  
  <p>I'm having these errors :</p>
  
  <pre>
  error C2440: 'initializing' : cannot convert from 'void *' to 'MEMBLOCK *'          
  error C2440: '=' : cannot convert from 'PVOID' to 'unsigned char *'    
  error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
  </pre>
  
  <p>I'm kinda newbie. Can you please provide a converted code for this that actually works with c++.</p>
  
  <p>Thank you</p>