c++ 关于指针以及(&)使用的一些小问题
查看下一篇博文:https://blog.****.net/yimixgg/article/details/79956031
引用:&
1、&在等号的前面
int a; int &ra=a; //定义引用ra,它是变量a的引用,即别名
2、&在等号的后面
A 、 int *i=&p,把p的地址给i,即i的指针指向p指针的地址
B、string *another=&name;string *namevec;
对比1、this->namevec=another;2、another=this->namevec;
2、 new新内存出来之后要记得delete掉
3、在不同的.h文件中可以定义相同的变量名 (具体情况要具体的用法)