title: Accessing array declared by malloc on STM32 Eval board
body: <p>I'm currently porting code that I wrote for some other embedded system to a STM Evalution Board (STM32F407). 
  I used malloc in the following way on the old board (Simplified for clarity):</p>
  
  <pre><code>float* values = (float*)malloc(sizeof(float)*NO_OF_ATT);
  
  values[0] = 1.0;
  values[1] = 2.0;
  values[2] = 3.0;
  values[3] = 4.0;
  </code></pre>
  
  <p>This code was working as expected.
  However on the STM board when I run this code it seems that I cannot access the array in this way, instead of the values it just outputs values like 3.85205412e-034.
  I thought in C notation x[y] is equivalent to *(x + y)?
  Anybody can help me in trying to understand what's happening?
  Thanks in advance!</p>
  
  <p>edit:
  Here is the non-simplified code:</p>
  
  <pre><code>    l = (dllist*)calloc(sizeof(dllist),0);
  
  l-&gt;Distance = 0;
  
  for (int i = 0; i &lt; NO_OF_ATT; i++)
  {
      l-&gt;Value[i] = featureValues[i];
  
      if (i == (NO_OF_ATT - 1))
      {
          l-&gt;Value[i] = (int)featureValues[i];
      }
  }
  
  
  sglib_dllist_add(&amp;queryList, l);
  </code></pre>
  
  <p>The featureValues array has the correct values but l->value array doesn't.
  Screenshot:<a href="https://i.stack.imgur.com/yGAeg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yGAeg.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>Struct definition:</p>
  
  <pre><code>typedef struct dllist {
     float Value[NO_OF_ATT];
     float Distance;
     struct dllist *ptr_to_next;
     struct dllist *ptr_to_previous;
  } dllist;
  </code></pre>
  
  <p>I just want to clarify: My code runs fine in Visual Studio and my second embedded system. It's just not working as expected on my STM board.</p>