A
anon.asdf
Hi!
Q. 1)
How does one write:
sizeof(array of 5 "pointers to double")
???
I know that
sizeof(pointer to an array of 5 doubles) can be written as:
sizeof(double (*)[5]);
Q. 2)
Why does this work:
int main(void)
{
double array_of_5_double[] = {0.5, 1.5, 2.5, 3.5, 4.5};
double *X[5] = \
{&array_of_5_double[0], /* array_of_5_double */ \
&array_of_5_double[1], \
&array_of_5_double[2], \
&array_of_5_double[3], \
&array_of_5_double[4]};
return 0;
}
but this NOT WORK
int main(void)
{
double array_of_5_double[] = {0.5, 1.5, 2.5, 3.5, 4.5};
double *X[5];
X = \
{&array_of_5_double[0], /* array_of_5_double */ \
&array_of_5_double[1], \
&array_of_5_double[2], \
&array_of_5_double[3], \
&array_of_5_double[4]};
return 0;
}
????
How can the bottom code snippet be written?
Thanks. -anon.asdf
Q. 1)
How does one write:
sizeof(array of 5 "pointers to double")
???
I know that
sizeof(pointer to an array of 5 doubles) can be written as:
sizeof(double (*)[5]);
Q. 2)
Why does this work:
int main(void)
{
double array_of_5_double[] = {0.5, 1.5, 2.5, 3.5, 4.5};
double *X[5] = \
{&array_of_5_double[0], /* array_of_5_double */ \
&array_of_5_double[1], \
&array_of_5_double[2], \
&array_of_5_double[3], \
&array_of_5_double[4]};
return 0;
}
but this NOT WORK
int main(void)
{
double array_of_5_double[] = {0.5, 1.5, 2.5, 3.5, 4.5};
double *X[5];
X = \
{&array_of_5_double[0], /* array_of_5_double */ \
&array_of_5_double[1], \
&array_of_5_double[2], \
&array_of_5_double[3], \
&array_of_5_double[4]};
return 0;
}
????
How can the bottom code snippet be written?
Thanks. -anon.asdf