title: How to get the length of a dynamically created array of structs in C?
body: <p>I am currently trying to get the length of a dynamically generated array. It is an array of structs:</p>
  
  <pre><code>typedef struct _my_data_ 
  {
    unsigned int id;
    double latitude;
    double longitude;
    unsigned int content_len;
    char* name_dyn;
    char* descr_dyn;
  } mydata;
  </code></pre>
  
  <p>I intialize my array like that:</p>
  
  <pre><code>mydata* arr = (mydata*) malloc(sizeof(mydata));
  </code></pre>
  
  <p>And then resized it using <strong>realloc</strong> and started to fill it with data.</p>
  
  <p>I then attempted to get its size using the code described <a href="https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c">here</a>.</p>
  
  <pre><code>sizeof(arr) / sizeof(arr[0])
  </code></pre>
  
  <p>This operation returns <strong>0</strong> even though my array contains two elements.</p>
  
  <p>Could someone please tell me what I'm doing wrong?</p>