c++中reference是什么意思int **p1; // p1 is a pointer to a pointer to an int.int *&p2; // p2 is a reference to a pointer to an int.int *p3; // ERROR:Pointer to a reference is illegal.int &p4; // ERROR:Reference to a reference is illegal.

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 08:24:38
c++中reference是什么意思int **p1; // p1 is a pointer to a pointer to an int.int *&p2; // p2 is a reference to a pointer to an int.int *p3; // ERROR:Pointer to a reference is illegal.int &p4; // ERROR:Reference to a reference is illegal.
xNP_+Bl@WJع TCBIaM%RbbY!hH$\DJ.L{x Ox l]tf?? nDy!~X62Cj8 2˄cLAQZE&#0m3.s, ~Ў p!wj\8Oql-??b#d_k/`*X0˦!>Z5 k3r 1(A;eN Td(t!t6<$ug}U1jMyzB% %ZU26iQkAk1 t2jRLZLP@_ eԡm -.i'An9(z1!|;9

c++中reference是什么意思int **p1; // p1 is a pointer to a pointer to an int.int *&p2; // p2 is a reference to a pointer to an int.int *p3; // ERROR:Pointer to a reference is illegal.int &p4; // ERROR:Reference to a reference is illegal.
c++中reference是什么意思
int **p1; // p1 is a pointer to a pointer to an int.
int *&p2; // p2 is a reference to a pointer to an int.
int *p3; // ERROR:Pointer to a reference is illegal.
int &p4; // ERROR:Reference to a reference is illegal.

c++中reference是什么意思int **p1; // p1 is a pointer to a pointer to an int.int *&p2; // p2 is a reference to a pointer to an int.int *p3; // ERROR:Pointer to a reference is illegal.int &p4; // ERROR:Reference to a reference is illegal.
简单的说就是一个“别名”而已~比如罗纳尔多,又叫做胖罗,肥罗,外星人,都是指一个人,罗纳尔多进球了就等于是胖罗,肥罗,外星人进球了~行为跟指针一样的~不过在定义一个引用的时候一定要初始化.