123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <iostream>
- #if(0)
- void swap01(int a, int b)
- {
- int temp = a;
- a = b;
- b = temp;
- std::cout << "swap01 a =" << a << std::endl;
- std::cout << "swap01 b =" << b << std::endl;
- }
- void swap02(int* p1, int* p2)
- {
- int temp = *p1;
- *p1 = *p2;
- *p2 = temp;
- }
- int main()
- {
-
- int a = 10;
- int b = 20;
- swap01(a, b);
- std::cout << "a = " << a << std::endl;
- std::cout << "b = " << b << std::endl;
-
-
- swap02(&a, &b);
- system("pause");
- return 0;
- }
- #endif
|