Link to home
Start Free TrialLog in
Avatar of jit1
jit1

asked on

with using temp

give two functions to swap variables without using temp variables
Avatar of jit1
jit1

ASKER

please give answer to this Q
Look like a homework. But in Assembler: load 2-nd to registre,
move 1-st to 2-nd, save from registe to 1-st.
In C: save 2-nd to disk, move 1-st to 2-nd, read from disk to 1-st.
XOR algorithm, a sequence of XORs let's you swap variables with a temp in disk or memory
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
use inline assembly

asm {
    push Variable_A
    push Variable_B
    pop   Variable_A
    pop   Variable_B
}