-
完全等价,和区别查看全部
-
const int x = 3; //常量 x无法更改!!!!查看全部
-
int x = 3 //变量 : 变量名 x,存储地址 &x, 存储内容 3;查看全部
-
#include<iostream> using namespace std; void fun(int &a,int &b); int main(void) { int x = 10,y = 20; //实参 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,相当于将20赋值给*p,相当于将20赋值给a cout << a << endl; //a相应的改变 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; //对c进行赋值 c.y= 20; cout << c1.x << " " << c1.y << endl; //c1相应的改变 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; }查看全部
-
申请空间查看全部
-
参数列表一定写在最右边查看全部
-
申请内存用new,释放内存用delete; 申请内存后要判断是否成功,释放内存要设空指针。查看全部
-
inline 函数名 for 和while循环不要用内联函数 递归函数无法使用内联方式查看全部
-
delete 后别忘了将指针置为 NULL查看全部
-
调用->找到入口->执行调用->返回入口->调用结束查看全部
-
基本数据类型的引用,int a=3; int &b=a; 别名 结构体类型的引用,{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;查看全部
-
内存管理查看全部
举报
0/150
提交
取消