评论

  • 在不另外申请内存空间的条件下,将两个整数互换。
    i think your ans is incorrect!!
    maybe you shoud use xor to accomplish it
    main()
    {
    int x=1,y=2;
    cout<< x << y << endl; //output 1 2
    x ^= y
    y ^= x
    x ^= y
    cout<< x << y << endl; //output 2 1
    }
    then done!!