title: Understand RtlMoveMemory
body: <p>Thanks for reading this. I'm trying to understand this one out of curiosity. I copied this code from somewhere, try to mess around but it does not work as expected. I expect <code>Debug.Print c</code> to return 4, but it stays 3. I suspect the error could be in data type but not sure, as no error popup.</p>
  
  <pre><code>Option Explicit
  
  #If VBA7 Then
      Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias _
              "RtlMoveMemory" (ByRef Destination As LongPtr, ByRef Source As LongPtr, _
              ByVal Length As LongPtr)
  #Else
      Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias _
             "RtlMoveMemory" (Destination As Long, Source As Long, _
              ByVal Length As Long)
  #End If
  
  Sub Main2()
      Dim c As Long, d As Long
  
      c = 3
      Move2 VarPtr(c)
      Debug.Print c
  
  End Sub
  
  Sub Move2(ByVal pointerOfi As LongPtr)
      Dim tempvalue As Long
  
      CopyMemory VarPtr(tempvalue), pointerOfi, LenB(pointerOfi)
      tempvalue = tempvalue + 1
      CopyMemory pointerOfi, VarPtr(tempvalue), LenB(pointerOfi)
  
  End Sub
  </code></pre>