title: Copying data from one address to another using pointers
body: <p>I am trying to move a halfword i.e 16 bits from one memory address of my microcontroller to another using C. Please have a look at my simple code below:</p>
  
  <pre><code>#include &lt;stdint.h&gt;
  
  int main(void){
  
      int16_t *src = (int16_t*)0x20000000; //source memory address
      int16_t *dst = (int16_t*)0x20000016; //destination memory address
      *dst = *src; //dereference both, set destination value to source value
      return 0;
  }
  </code></pre>
  
  <p>As soon as I hit the line <code>*dst = *src</code>, I run into a Hardfault exception. My low understanding of pointers and dereference/reference could be the problem. I would appreciate some help.  </p>
  
  <p>EDIT:
  Is there any way I can write this in a single line of code using the assignment operator (=)?</p>