title: C++ Write Memory Function vs. Pointer
body: <p>What's the difference between using a memory writing function like <code>WriteProcessMemory</code> and a pointer to write to memory? Say I had this address <code>0x12345</code>, and I wanted the byte at that address to be <code>0x15</code>. I could do this:</p>
  
  <pre><code>*(unsigned char*)0x12345 = 0x15;
  </code></pre>
  
  <p>and I could do this:</p>
  
  <pre><code>unsigned char data = 0x15;
  WriteProcessMemory(handle,(LPVOID)pointer, &amp;data, sizeof(data), NULL);
  </code></pre>
  
  <p>What is the advantage of one over the other?</p>