The simplest thing is to make your program compilable and give it strictly defined behaviour, then run it.
#include <stdio.h>
int main(void)
{
double d[2] = { 3.141593, 2.718128 };
double *dp = &d[0];
double *dpa[2] = { &d[0], &d[1] };
double **dpp = dpa;
printf("dp = %p\n", (void *)dp);
printf("dpp = %p\n", (void *)dpp);
dp++;
dpp++;
printf("dp = %p\n", (void *)dp);
printf("dpp = %p\n", (void *)dpp);
return 0;
}
Note how the code carefully ensures that the pointers always point to valid data. You could extend the printing to print *dpp
(another pointer) and **dpp
and *dp
(both double values).
On my machine (Mac OS X 10.9.1, GCC 4.8.2, 64-bit compilation), the output is:
dp = 0x7fff56945510
dpp = 0x7fff56945520
dp = 0x7fff56945518
dpp = 0x7fff56945528
When compiled for 32-bit, the output is:
dp = 0xbfffc600
dpp = 0xbfffc5f0
dp = 0xbfffc608
dpp = 0xbfffc5f4
The jump of 8 in dp
is a consequence of sizeof(double) == 8
(for both 32-bit and 64-bit compilations). The change in dpp
of 4 for the 32-bit compilation and 8 for the 64-bit compilation is a consequence of sizeof(double *) == 4
for 32-bit and sizeof(double *) == 8
for 64-bit.