如代码注释中所述,当我尝试查找已取消引用的数组的地址时,它与我直接从数组中获取的地址有所不同。
int main()
{
double disp[1][2][2] = {{
{10, 11},
{14, 15}}
};
for(int i = 0 ; i < 4 ; ++i){
printf("%d ", &(((double *)disp)[i]));
printf("%f ", (((double *)disp)[i]));
//Here it give -1532765552 as address of value 10.000000
}
//but here it give -1532765552 as the address of 15.000000
printf("\n%d ", &(*disp));
printf("\n%f ", (*disp));
return 0;
}
答案 0 :(得分:1)
这是因为JsonRpc 2.0
的类型为*disp
,而double[2][2]
的类型为*(double *)disp
,即使地址相同。所以double
是未定义的行为
printf("\n%f ", (*disp));