镇乃天子
This commit is contained in:
18
666/交换3.cpp
Normal file
18
666/交换3.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
|
||||
int a=25,b=32,tmp;
|
||||
int *ptr_a, *ptr_b;
|
||||
|
||||
ptr_a=&a;
|
||||
ptr_b=&b;
|
||||
|
||||
cout<<*ptr_a<<" "<<*ptr_b<<" ";
|
||||
cout<<ptr_a<<" "<<ptr_b<<" ";
|
||||
tmp=*ptr_a;
|
||||
*ptr_a=*ptr_b;
|
||||
*ptr_b=tmp;
|
||||
cout<<a<<" "<<b<<endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user