X and y are formal parameters. When swap(a, b) is called, x=a and y=b are assigned, and the function is no longer related to A and B. ..
The result of the exchange is only to exchange the numbers in x and y, not a and B.
If you want to exchange A and B, you should use swap (&; I. & ampb)
If you don't understand, keep asking questions.