title: C++
date: 2023-02-22 18:32:16
tags: code
category: study
关于C++传引用和传参数的理解
代码
#include <iostream>
using namespace std;
void test(int &a){
a = 3;
cout << &a << " " << a << endl;
}
int main(void){
int a = 1;
cout << &a << " " << a << endl;
test(a);
cout << &a << " " << a << endl;
return 0;
}
标签:代码,C++,C语言,参数,引用,传值
From: https://www.cnblogs.com/smile2game/p/17379536.html