📄 passptr.cpp
字号:
// passptr.cpp
// arguments passed by pointer
#include <iostream>
using namespace std;
int main()
{
void centimize(double*); //prototype
double var = 10.0; //var has value of 10 inches
cout << "var = " << var << " inches" << endl;
centimize(&var); //change var to centimeters
cout << "var = " << var << " centimeters" << endl;
return 0;
}
//--------------------------------------------------------------
void centimize(double* ptrd)
{
*ptrd *= 2.54; //*ptrd is the same as var
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -