-
完全等價(jià),和區(qū)別查看全部
-
const int x = 3; //常量 x無(wú)法更改?。。。?查看全部
-
int x = 3 //變量 : 變量名 x,存儲(chǔ)地址 &x, 存儲(chǔ)內(nèi)容 3;查看全部
-
#include<iostream> using namespace std; void fun(int &a,int &b); int main(void) { int x = 10,y = 20; //實(shí)參 cout << x << " " << y << endl; fun(x,y); cout << x << " " << y << endl; system("pause"); return 0; } void fun(int &a,int &b) //形參 { int c = 0;//賦初值 c = a; a = b; b = c; }查看全部
-
#include<iostream> using namespace std; int main(void) { int a = 10; int *p = &a;// 指針p指向a int *&q = p;//指針類型的引用 ,q是p的別名 *q = 20;// 20賦值給*q,相當(dāng)于將20賦值給*p,相當(dāng)于將20賦值給a cout << a << endl; //a相應(yīng)的改變 system("pause"); return 0; }查看全部
-
#include<iostream> using namespace std; typedef struct { int x; int y; } Coor; int main(void) { Coor c1; Coor &c = c1; //c是c1的別名, c.x= 10; //對(duì)c進(jìn)行賦值 c.y= 20; cout << c1.x << " " << c1.y << endl; //c1相應(yīng)的改變 system("pause"); return 0; }查看全部
-
#include<iostream> using namespace std; int main(void) { int a = 10; int &b = a; //引用必須初始化 b = 20; cout << a << endl; a = 30; cout << a << endl; system("pause"); return 0; }查看全部
-
申請(qǐng)空間查看全部
-
參數(shù)列表一定寫在最右邊查看全部
-
申請(qǐng)內(nèi)存用new,釋放內(nèi)存用delete; 申請(qǐng)內(nèi)存后要判斷是否成功,釋放內(nèi)存要設(shè)空指針。查看全部
-
inline 函數(shù)名 for 和while循環(huán)不要用內(nèi)聯(lián)函數(shù) 遞歸函數(shù)無(wú)法使用內(nèi)聯(lián)方式查看全部
-
delete 后別忘了將指針置為 NULL查看全部
-
調(diào)用->找到入口->執(zhí)行調(diào)用->返回入口->調(diào)用結(jié)束查看全部
-
基本數(shù)據(jù)類型的引用,int a=3; int &b=a; 別名 結(jié)構(gòu)體類型的引用,{coor c1; coor &c=c1; c.x=10; c.y=20; cout<<c1.x<<c1.y; return 0;} 指針類型的引用 { int a=10; int *p=&a; int *&q=p; *q=20 cout<<a<<endl;查看全部
-
內(nèi)存管理查看全部
舉報(bào)
0/150
提交
取消