You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
264 B
20 lines
264 B
2 years ago
|
//6.2.1传值参数.cpp
|
||
|
#include <iostream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
void x(int *i);
|
||
|
|
||
|
int main(){
|
||
|
int i=12;
|
||
|
x(&i);
|
||
|
cout << i << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
void x(int *i){
|
||
|
*i=0;//这里修改了i所指的对象的值;
|
||
|
i=0;//这里只是修改了i所指的对象;
|
||
|
}
|