title: How to place an array at a specific memory location that is provided from a variable?
body: <p>For an embedded system project, an array is supposed to be placed in RAM. I have split the device's RAM into two sections, one which stores globals and other data, and another section, RAM_DATA, which I wish to store two arrays (a source location and a destination location). </p>
  
  <p>There is a global value <code>mem_val</code> that is set to the start of the RAM_DATA address, and now wanted to make the source array begin at the location which is stored held in <code>location</code>. </p>
  
  <p>From what I have garnered from online sources, they utilize the <code>stdint.h</code> header file to use <code>uintptr_t</code> and <code>uint32_t</code> values to set start of the array. When debugging the program, the array does not start at this value, and was inquiring about how to fix this problem. Here is some code that is relevant to the question.</p>
  
  <pre><code>volatile uintptr_t mem_val = 0x0219;
  
   int main(void)
   {
        char cur_loc[128];
        uint32_t *cur_loc = (void *)mem_val;
        ...
        return 0;
   }
  </code></pre>
  
  <p>Obviously there is something wrong with the array initialization and then making it pointer, but beyond that, is there a method of making the array <code>cur_loc</code> begin at the value given to <code>mem_val</code>? If it helps, I am working with a Texas Instruments MSP430 embedded device. Thank you</p>