title: Find sum of the gaps in array, assembly language
body: <p>I'm am stuck like crazy on this question. We're supposed to find the sum of the gaps in our array. I've got the code written to find the sum of the array but no idea how to find the sum of the gaps. Here's what I have. So the gaps are 2,3,4,1 and the sum should be 10.</p>
  
  <pre><code>.386
  .model flat,stdcall
  .stack 4096
  ExitProcess proto,dwExitCode:dword
  
  .data
      array DWORD 0,2,5,9,10  
  .code
  main proc
      mov edi,OFFSET array
      mov ecx,LENGTHOF array
      mov eax,0
  
  L1:
      add eax,[edi]
      add edi,TYPE array
      loop L1
  
      invoke ExitProcess,0
  main endp
  end main
  </code></pre>