1.值传递
swap(int i,int j){
int temp = i;
i = j;
j = temp;
}
2.引用传递
swap2(int* pointer1,int* pointer2){
int temp = *pointer1;
*pointer1 = *pointer2;
*pointer2 = temp;
}
1.值传递
swap(int i,int j){
int temp = i;
i = j;
j = temp;
}
2.引用传递
swap2(int* pointer1,int* pointer2){
int temp = *pointer1;
*pointer1 = *pointer2;
*pointer2 = temp;
}