总结 :
在c中传值是值传递,地址传递
c++中才有了引用传递的概念
地址传递的引用方式是
function(int * x){
*x = *x + 10;
}
int a=10;
function(&a);
引用传递
function2(int $x){
x =x + 10
}
int a=10;
function(a);
可以看到两个调用函数不同之处。
总结 :
在c中传值是值传递,地址传递
c++中才有了引用传递的概念
地址传递的引用方式是
function(int * x){
*x = *x + 10;
}
int a=10;
function(&a);
引用传递
function2(int $x){
x =x + 10
}
int a=10;
function(a);
可以看到两个调用函数不同之处。