Ver Mensaje Individual
  #1  
Antiguo 20-07-2007
ALAM ALAM is offline
Registrado
 
Registrado: abr 2007
Posts: 7
Reputación: 0
ALAM Va por buen camino
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.
Responder Con Cita