You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Asignación dinámica <strong>de</strong> memoria: new y <strong>de</strong>lete<br />
En C la asignación dinámica <strong>de</strong> memoria se manipula con las funciones malloc() y free(). En <strong>C++</strong> se<br />
<strong>de</strong>fine un método <strong>de</strong> hacer asignación dinámica utilizando los operadores new y <strong>de</strong>lete.<br />
En C:<br />
void main()<br />
{<br />
int *z;<br />
z= (int*) malloc(sizeof(int));<br />
*z=342;<br />
printf("%d\n",*z);<br />
free(z);<br />
}<br />
En <strong>C++</strong>:<br />
void main()<br />
{<br />
int *z=new int;<br />
*z=342;<br />
cout