title: How make a dynamic array using void** and void*?
body: <p>I want to make a dynamic memory array function where in the arguments I can put in any type I want, the count, and the item I want. I've been googling and looking at YT videos, but none of them explain how to do just THAT, and when the item I want is a pointer. For example, I would have this:</p>
  
  <pre><code>struct Entity
  {
     int health;
     int level;
     int experience;
     char* name;
  }
  
  Entity** entitylist = NULL;
  int entitycount = 0;
  
  Entity* CreateEntity(/*args for creating an entity*/)
  {
     Entity* newentity = malloc(sizeof(Entity));
     // All of the entity creation stuff and at the end...
     AddItemToList(&amp;Entity, &amp;newentity, &amp;entitycount);
  }
  </code></pre>
  
  <p>I know in the function I want to create I would need to pass in references to the specific list, but from that I'm pretty much clueless. I've tried to use malloc and realloc but either crashes the program or does nothing. And would new and delete work for this type of stuff?</p>
  
  <p>And how would removing something like this work? I haven't seen anything on the internet yet about removing an item from a list, only adding them.</p>
  
  <p>Thanks!</p>