C++中*&(指针引用)和*(指针)的区别

C++中若是参数不是引用的话会调用参数对象的拷贝构造函数,因此若是有需求想改变指针所指的对象(换句话说,就是要改变指针里面存的地址),就要使用指针引用ios #include <iostream> using namespace std; struct point { int x; int y; }; void changenum1(point *&pnum) { pn
相关文章
相关标签/搜索