64,680
社区成员
发帖
与我相关
我的任务
分享
double*** hist;
int d = 4,n = 4;
hist = (double***)calloc(d,sizeof(double**));
for (int i = 0;i < d;i++)
{
hist[i] = (double**)calloc(d,sizeof(double*));
for (int j = 0;j < n;j++)
{
hist[i][j] = (double*)calloc(n,sizeof(double));
}
}
for (int i = 0;i < d;i++)
{
for (int j = 0;j < d;j++)
{
free(hist[i][j]);
}
}
for (int i = 0;i < d;i++)
{
free(hist[i]);
}
free(hist);
double*** hist;
int d = 4,n = 4;
hist = (double***)calloc(d,sizeof(double**));
for (int i = 0;i < d;i++)
{
hist[i] = (double**)calloc(d,sizeof(double*));
for (int j = 0;j < n;j++)
{
hist[i][j] = (double*)calloc(n,sizeof(double));
}
}
for (int i = 0;i < d;i++)
{
for (int j = 0;j < d;j++)//d改成n
{
free(hist[i][j]);
}
}
for (int i = 0;i < d;i++)
{
free(hist[i]);
}
free(hist);