第23568题 判断题
判断:执行给定C++数组指针相减代码的输出是否为8

执行下面的C++代码,会输出 8 ,因为两个指针地址相差 8 个字节(假设 int 占 4 字节)。

int arr[5] = {1, 2, 3, 4, 5};
int* p1 = arr;
int* p2 = arr + 2;
cout << p2 - p1; // 输出结果
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析