/*
练习3.34:
假定p1和p2指向同一个数组中的元素,则下面程序的功能是什么?
什么情况下该程序是非法的?
p1 += p2 - p1;
答:功能:让p1指向p2的位置。
Any legal value p1, p2 make this code legal.
*/
#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>
#include <cctype>
#include <cstring>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
int main()
{
cout<<endl;
return 0;
}
C++Primer第五版第三章练习3.34
于 2023-12-22 16:03:41 首次发布
文章讨论了在C++中,当p1和p2指向同一数组元素时,通过p1+=p2-p1的代码实现p1指向p2的操作。重点在于指出何时这个操作是合法的,以及什么样的输入值使代码合法。
33万+

被折叠的 条评论
为什么被折叠?



