传值,传引用

值传递:函数操作的是形参,将实参拷贝给形参,拷贝完成后对形参修改不会影响实参,实参的值不会改变。 void swapValue(int x, int y) { cout << "交换前:" << endl; cout << "x=" <<x<<";y="<<y<< endl; int temp; temp = x; x = y; y = temp; cout << "交换后:" <<
相关文章
相关标签/搜索