⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c11_07.cpp

📁 it can help you know C++ souce program quckily
💻 CPP
字号:
//***********************************
//**         C11_07.cpp            **
//**      指针作为参数传递         **
//***********************************
# include <iostream >
using namespace std;

void swap(int *a, int *b)	//函数定义,a和b是形式参数
{
	int		temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

int main()
{
	int		i,j;
	i = 10;
	j = 20;
	cout<<"Before swap"<<endl;
	cout<<"i = "<<i<<","<<"j = "<<j<<endl;
	swap(&i, &j);			//调用函数swap(&i,&j),&i和&j是实参
	cout<<"After swap"<<endl;
	cout<<"i = " <<i<<","<<"j = "<<j<<endl;		//i=20,j=10;
	
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -