Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   C++ Builder (https://www.clubdelphi.com/foros/forumdisplay.php?f=13)
-   -   Reservar memoria dinámica (https://www.clubdelphi.com/foros/showthread.php?t=46007)

ALAM 20-07-2007 14:27:11

Reservar memoria dinámica
 
Hola, tengo un problema con estos punteros cuando reservo memoria. Si alguién ve algún error agradezco me lo digan.

Código:


int dim_matrix = 100;
if((ppG_H_ElemMatrix = (double **)calloc( 4, sizeof(double *) ))==0 )
return FALSE;
 
if((ppG_H_ElemMatrix[0] = (double *)calloc((short)dim_matrix, sizeof( double ) ))==0 )
return FALSE;
if((ppG_H_ElemMatrix[1] = (double *)calloc((short)dim_matrix, sizeof( double ) ))==0 )
return FALSE;
if((ppG_H_ElemMatrix[2] = (double *)calloc((short)dim_matrix, sizeof( double ) ))==0 )
return FALSE;
if((ppG_H_ElemMatrix[3] = (double *)calloc((short)dim_matrix, sizeof( double ) ))==0 )
return FALSE;

Debo aclarles que estoy programando bajo mindows y utilizo el builder c++ 6.0.

Otra cosa: ya se que lo más aconsejable es utilizar new y delete, pero el caso es que lo tengo ahí me arroja un error cuando intenta reservar la memoria para ppG_H_ElemMatrix[3] y no entiendo por qué?

Nuevamente gracias.


La franja horaria es GMT +2. Ahora son las 04:51:12.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi