dynamic memory allocation
<p>here is  example how Pointers are used to store and manage the addresses of dynamically allocated blocks of memory  </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
using namespace std;
struct Item{
    int id;
    char* name;
    float cost;
    };
   struct Item*make_item(const char *name){
        struct Item *item;
        item=malloc(sizeof(struct Item));
        if (item==NULL)
             return NULL;
        memset(item,0,sizeof(struct Item));
        item-&gt;id=-1;
        item-&gt;name=NULL;
        item-&gt;cost=0.0;

         /* Save a copy of the name in the new Item */
        item-&gt;name=malloc(strlen(name)+1);
        if (item-&gt;name=NULL){
            free(item);
            return NULL;
        }

        strcpy(item-&gt;name,name);
         return item;

        }

int main(){



     return 0;
}
</code></pre>

<p>but here is mistakes</p>

<p>1</p>

<pre><code>&gt;------ Build started: Project: dynamic_memory, Configuration: Debug Win32 ------
1&gt;  dynamic_memory.cpp
1&gt;c:\users\david\documents\visual studio 2010\projects\dynamic_memory\dynamic_memory.cpp(11): error C2440: '=' : cannot convert from 'void *' to 'Item *'
1&gt;          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1&gt;c:\users\david\documents\visual studio 2010\projects\dynamic_memory\dynamic_memory.cpp(20): error C2440: '=' : cannot convert from 'void *' to 'char *'
1&gt;          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
</code></pre>

<p>what is wrong?please help</p>
