-
cout<<a<<endl; 输出10查看全部
-
int &b = a; //给a取别名 b b=10 cout<<b<<endl; 输出10查看全部
-
引用是变量的 一个别名查看全部
-
const与指针类型查看全部
-
函数引用: #include<iostream> #include<stdlib.h> using namespace std; void fun(int &a,int &b) { int c=0; c=a; a=b; b=c; } int main(void) { int x=10; int y=20; cout<<x<<","<<y<<endl; fun(x,y); cout<<x<<","<<y<<endl; system("pause"); return 0; }查看全部
-
指针引用; #include<iostream> #include<stdlib.h> using namespace std; int main() { int a=3; int *p=&a; int *&q=p; *q=5; cout<<a<<endl; system("pause"); return 0; }查看全部
-
结构体引用: #include<iostream> #include<stdlib.h> using namespace std; typedef struct { int x; int y; }coord; int main() { coord c; coord &c1=c; c1.x=10; c1.y=20; cout<<c.x<<","<<c.y<<endl; return 0; }查看全部
-
#include<iostream> #include<stdlib.h> using namespace std; int main(void) { int a=10; int &b=a; b=20; cout<<a<<endl; a=30; cout<<b<<endl; system("pause"); return 0; }查看全部
-
222222查看全部
-
1333查看全部
-
const与指针2查看全部
-
const与指针查看全部
-
指针引用查看全部
-
函数参数默认值:默认值写在函数声明中查看全部
-
函数默认参数:有默认参数值的参数必须在参数表的最右端查看全部
举报
0/150
提交
取消