title: How does XCHG work in Intel Assembly Language?
body: <p>Can someone please explain how the <code>xchg</code> instruction works in next code? It is given that <em>arrayD</em> is an DWORD array of 1,2,3.</p>
  <pre><code>mov  eax, arrayD      ; eax=1
  xchg eax, [arrayD+4]  ; eax=2 arrayD=2,1,3
  </code></pre>
  <p>Why isn't the array 1,1,3 after the <code>xchg</code>?</p>