Incompatible pointer type - C
<p>I have this structure of structs, presented in this code:</p>

<pre><code>typedef void* DataP;
typedef struct Table* TableP;
typedef const void* ConstKeyP;

typedef struct DataPointer
{
    DataP dataP;
    ConstKeyP key;
}DataPointer;

typedef struct HashTableSet
{
DataPointer *hashSet[MAX_ROW_ELEMENTS];
}HashTableSet;

typedef struct HashTableSet *HashTable;

typedef struct Table
{
int size, d;
HashTable hashTable;
}Table;
</code></pre>

<p>That is the structure.
Now here is the function that creates the hash table - </p>

<pre><code>TableP createTable(size_t tableSize)
{
TableP tableP = (TableP)malloc(sizeof(Table));
HashTable table = (HashTable)malloc(sizeof(HashTable));
tableP-&gt;d = 1;
tableP-&gt;size = tableSize;
nullTable(tableP);
return tableP;
}
</code></pre>

<p>where nullTable is a function that i want to both to give memory for the actual sets and also give null initial value:</p>

<pre><code>void nullTable(TableP tableP)
{
HashTable hashTable = tableP-&gt;hashTable;
int i = 0;
for(;  i &lt; tableP-&gt;size; i++)
{
    int j = 0;
    HashTableSet *hashTableSet = (HashTableSet*)malloc(sizeof(HashTableSet));
    for (; j &lt; MAX_ROW_ELEMENTS ; ++j)
    {

        DataPointer *data = (DataPointer*)malloc(sizeof(HashTableSet));
        hashTableSet-&gt;hashSet[j] = data;
    }
    hashTable[i] = *hashTableSet;
    //hashTable-&gt;hashSet = *hashTableSet;
    hashTable += sizeof(HashTableSet);

    }
}
</code></pre>

<p>First question comes up here - in the last lines of nullTable, i am trying to "jump" my pointer of hashTable to the next set memory. meaning i have allocated all the space i need for a set, pointed my hashTable[i] at it, and then i added sizeof(HashTableSet) to hashTable because i want it to get to the next "spot" for another hashTableSet. This already fills like i am doing something wrong.</p>

<p>Next i reach to my real problem of understanding how this pointer iterating works in this function:</p>

<pre><code>DataP removeData(TableP table, const void* key)
{
TableP tableP = table;
int cell = table-&gt;hfun(key, table-&gt;size);
HashTable hashTable = table-&gt;hashTable;
HashTableSet *setPtr = hashTable-&gt;hashSet;
int i = 0;
int j = 0;
int d = 1;
while(d &lt; tableP-&gt;d)
{
    for (; i &lt; MAX_ROW_ELEMENTS; i++)
    {
        if (table-&gt;fcomp(setPtr-&gt;hashSet[i]-&gt;key, key) == 0)
        {
            DataP dataP = setPtr-&gt;hashSet[i]-&gt;dataP;
            setPtr-&gt;hashSet[i] = NULL;
            table-&gt;freeKey((void*)key);
            return dataP;
        }
    }
    setPtr *= 2;
    i = 0;
}
return NULL;
}
</code></pre>

<p>I want setPtr to point at the first HashTableSet of my table. But i get this error message: </p>

<pre><code> warning: initialization from incompatible pointer type
 HashTableSet *setPtr = hashTable-&gt;hashSet;
</code></pre>

<p>I am also having a problem understanding how to take setPtr to the next hashSet, assuming that i managed to actually define setPtr correctly for my needs.</p>