~cpp #include<iostream> using namespace std; void swap(int *a, int *b); void main() { int a=1, b=18; cout << a<<" "<< b<<endl; swap(&a, &b); cout <<a<<" "<<b<<endl; } void swap(int *a,int *b) { int c; c = *b; *b = *a; *a = c; }
~cpp #include<iostream> using namespace std; void swap(int *a, int *b); void main() { int a=1, b=18; cout << a<<" "<< b<<endl; swap(&a, &b); cout <<a<<" "<<b<<endl; } void swap(int *a,int *b) { int c; c = *b; *b = *a; *a = c; }