title: why are the bytes in byte array reversed in C++
body: <p>the code i am trying to understand overwrites a section of a game process memory (window.h, WriteProcessMemory) in order to modify a parameter in the game (for example, strength). the values would most likely be integers</p>
  
  <p>the code attempts replacement with this function </p>
  
  <pre><code>WriteProcessMemory( GameHandle, (BYTE*)StrengthMemoryAddress, &amp;StrengthValue, sizeof(StrengthValue), NULL);
  </code></pre>
  
  <p>where StrengthMemoryAddress is a pre-calculated dynamic address and StrengthValue is the following:</p>
  
  <pre><code>byte StrengthValue[] = { 0x39, 0x5, 0x0, 0x0 };
  </code></pre>
  
  <p>it replaces strength with 1337</p>
  
  <p>my question is basically how the byte array works in this function. from google i know that the hex value of 1337 is 0x539. </p>
  
  <p>how come you have to reverse it in the byte array? i see that he first puts 0x39 then 0x5, which i concluded probably combines to 0x539 in some reverse order. also, why do you need the extra 0x0 at the end - can't you just leave it out?</p>
  
  <p>thanks</p>