ref_fun.cpp
来自「数据结构常用算法合集」· C++ 代码 · 共 20 行
CPP
20 行
//ref_fun.cpp
#include <iostream.h>
#include <conio.h>
int &fun(int);
int x=14; //整体变量
void main()
{ int a=10;
x=fun(2*a);
cout << "x=" << x << endl;
int b=fun(a);
cout<< "b=" << b << endl;
cout << "x=" << x << endl;
fun(5)=a; //赋值给函数
cout << "x="<< x << endl;
getch();
}
int &fun(int y)
{ x=y*x;
return x; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?