A
Andrew
Hi all, with the following code snippet I am creating a 2D matrix :
.......
double **retdouble=(double **)malloc(Y_dim*(sizeof(double *)));
if(retdouble == NULL)
{
printf("Error Allocating memory ..... \n");
exit(1);
}
for (int k=0; k<Y_dim; k++)
{
retdouble[k]=(double *)malloc(X_dim*(sizeof(double)));
// Could been *(retdouble+k) ...
if(retdouble[k]==NULL)
{
printf("Error Allocating memory ... \n");
exit(1);
}
}
................
Now once the matrix is created some operations have to be perfomred
and then i am supposed to erase the memory the matrix is holding ...
When typing "free(retdouble)" is all of the memory (
(X_dim)*(Y_dim)*(double) ) released ????
Any help appreciated
(Sorry for my english )
.......
double **retdouble=(double **)malloc(Y_dim*(sizeof(double *)));
if(retdouble == NULL)
{
printf("Error Allocating memory ..... \n");
exit(1);
}
for (int k=0; k<Y_dim; k++)
{
retdouble[k]=(double *)malloc(X_dim*(sizeof(double)));
// Could been *(retdouble+k) ...
if(retdouble[k]==NULL)
{
printf("Error Allocating memory ... \n");
exit(1);
}
}
................
Now once the matrix is created some operations have to be perfomred
and then i am supposed to erase the memory the matrix is holding ...
When typing "free(retdouble)" is all of the memory (
(X_dim)*(Y_dim)*(double) ) released ????
Any help appreciated
(Sorry for my english )