I realized that my function was just swapping parameters without affecting the arguments.
0 Answer
I realized that my function was just swapping parameters without affecting the arguments.
Changing the parameter does not change the argument
If you need to change the argument, the argument type should be a pointer
All arguments to the C function are passed as a "value call", which means that the function gets a copy of the parameter values. If you need to change the value of an argument, the argument type should be a pointer. In this case, you need to add an address.
Line 4 with & before x and y;
because it does not use the reference symbol & What is changed is only the substitute of x and y, not the change itself. Plus & If you don't use a surrogate, changes inside the function affect itself.
这家伙很懒,什么都没留下...