C memory pool storing : <p>I am writing small memory allocation system. Having: </p>

<pre><code>typedef struct _POOL
{
    int size;     /*size of memory pool*/
    void* memory; /*pointer to pool location in memory*/
} Pool;

Pool* allocatePool(int n) {
    Pool *myPool = malloc(sizeof(Pool) + n);

    if (myPool){
        myPool-&gt;size = n;
        myPool-&gt;memory = myPool+1;
    }

    return myPool;
}
</code></pre>

<p>I am trying to write function that will store arbitrary object of n size at location offset within the pool.</p>

<pre><code>void store(Pool* pool, int offset, int size, void *object) {
    char *ptrHelper;                  
    ptrHelper = &amp;(pool-&gt;memory);      /*copy pool memory address*/
    ptrHelper += offset;              /*increment to match offset*/
    memcpy(ptrHelper, &amp;object, size); /*copy object in to the pool*/
}
</code></pre>

<p>Questions:</p>

<p>ptrHelper = &amp;(pool->memory) is there another correct way of getting pool memory address?</p>

<p>What to do in case I want to store values grater than size of void *object (4 bytes in my case)?</p>

<p>How to correctly handle strings without changing functions parameter structure?
Thank you.</p>
