title: Why is uint8_t using up 4 bytes when assigned to a dereferenced uint32_t pointer?
body: <p>I had a bug in my application when assigning a byte value to dereferenced 4 byte pointer:</p>
  
  <pre><code>uint8_t value = 5;
  uint8_t myArray [4] = {1,2,3,4};
  uint32_t *myPointer = &amp;myArray[0];
  
  *myPointer = value; // myArray is now {5,0,0,0}
  //*(uint8_t*)myPointer = value; // works correctly, myArray: {5,2,3,4}
  </code></pre>
  
  <p>In my opinion this is a pretty nasty, hard-to-detect bug and no warning arises during compilation even with all warnings turned on. Why doesn't the compiler take care of this since the size of the <code>value</code> is obvious? Also, I though the notion of pointer size correlates to the ability of pointing to higher addresses, not how much memory is actually assigned. </p>