64,654
社区成员
发帖
与我相关
我的任务
分享
double *double_p = new double[3]{1, 2, 3};
int ia[3]{11, 22, 33};
auto int_pp = ia;
auto int_p = &ia;
// double_p[0] 怎么理解?
std::cout << double_p << ", " << *double_p << ", " << double_p[0] << std::endl;
// ia 是指向数组第一个元素的指针?
std::cout << ia << ", " << *ia << ", " << ia[0] << std::endl;
// 和直接使用 ia 一样?
std::cout << int_pp << ", " << *int_pp << ", " << int_pp[0] << std::endl;
// int_p 和 *int_p 值(地址)一样,为啥还要解两次才能拿到值?
std::cout << int_p << ", " << *int_p << ", " << **int_p << ", " << *int_p[0] << std::endl;