I need four dimensional array like
double a[256][256][256][256];
but the size is too big to use an array.
If I use only pointer like
double ****a;
to allocate this memory, I have to run 3 loops to allocate memory ..which takes lots of time.
a = (double **** ) malloc (sizeof(double ***)*256);
for(i=0;i<256;i++)
{
a[i] = (double ***) malloc ( sizeof(double **)*256);
for(j=0;j<256;j++)
{
a[i][j] = (double **) malloc ( sizeof(double *)*256);
for(k=0;k<256;k++)
{
a[i][j][k] = (double *) malloc ( sizeof(double )*256);
}
}
}
is there any other work around ....?
I was thinking to use *a[256][256][256]
Can I use this ...and if yes how I can allocate the memory for this...?
double a[256][256][256][256];
but the size is too big to use an array.
If I use only pointer like
double ****a;
to allocate this memory, I have to run 3 loops to allocate memory ..which takes lots of time.
a = (double **** ) malloc (sizeof(double ***)*256);
for(i=0;i<256;i++)
{
a[i] = (double ***) malloc ( sizeof(double **)*256);
for(j=0;j<256;j++)
{
a[i][j] = (double **) malloc ( sizeof(double *)*256);
for(k=0;k<256;k++)
{
a[i][j][k] = (double *) malloc ( sizeof(double )*256);
}
}
}
is there any other work around ....?
I was thinking to use *a[256][256][256]
Can I use this ...and if yes how I can allocate the memory for this...?
Send instant messages to your online friends http://uk.messenger.yahoo.com