C++?й????????????
???????????? ???????[ 2016/11/18 11:12:36 ] ??????????? C++
??????????????? ???????? & ?????? = ???????????????????
????C++??????????????????????????????ò????????????μ???????????????????????????????????????????????????????????????????????????????????
????//???3???
????<code>int ee = 100;
????int ff = 200;
????int &aa = ee;
????int &bb = ff;
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????cout << "aa???" << &aa << " aa?" << aa << endl;
????cout << "bb???" << &bb << " bb?" << bb << endl;
????</code>
????C++?й????????????
???????п?????????????????????????????????????????У??????????????????????????????е???????????????????????
??????????????????????????????????
????1?????????κ??βν???????????βη??????????????β??????ε??????????????????????????????????в???в?????ε????????????????ν??в??????????????????????????????????????????????????????????????βη???洢??????βα???????α??????????????????????????????????????????????????????????Ч???????????С??
????2?????????????????????Ч????????????βε??????????????ε??????
????//????????β?
????<code>void swap(int & a?? int &b)
????{
????int map = a;
????a = b;
????b = map;
????cout << "a???" << &a << " a?" << a << endl;
????cout << "b???" << &b << " b?" << b << endl;
????}
????int main(void)
????{
????int ee = 100;
????int ff = 200;
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????swap(ee?? ff);
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????return 0;
????}
????</code>
????C++?й????????????
????//??????
????<code>void swap(int * a?? int *b)
????{
????int map = *a;
????*a = *b;
????*b = map;
????cout << "a???" << &a << " a?" << a << endl;
????cout << "b???" << &b << " b?" << b << endl;
????}
????int main(void)
????{
????int ee = 100;
????int ff = 200;
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????swap(&ee??&ff);
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????return 0;
????}
????</code>
????C++?й????????????
???????п?????????????????????????
????//?????????????????
????<code>void swap(int a?? int b)
????{
????int map = a;
????a = b;
????b = map;
????cout << "a???" << &a << " a?" << a << endl;
????cout << "b???" << &b << " b?" << b << endl;
????}
????int main(void)
????{
????int ee = 100;
????int ff = 200;
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????swap(ee??ff);
????cout << "ee???" << &ee << " ee?" << ee << endl;
????cout << "ff???" << &ff << " ff?" << ff << endl;
????return 0;
????}
????</code>
????C++?й????????????
??????????????????????????????????
????????????????????????????
????//????????????????
????<code>int& fun(int & num)
????{
????return num;
????}
????int main(void)
????{
????int aa?? bb;
????aa = fun(bb);
????cout << aa << " " << bb << endl;
????return 0;
????}</code>
????//???????????????
????<code> int* fun(int * num)
????{
????return num;
????}
????int main(void)
????{
????int aa?? bb;
????aa = *fun(&bb);
????cout << aa << " " << bb << endl;
????return 0;
????}</code>
????----------------------??????---------------------------
????<code>???????д????????????????????????????????????</code>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11