c programming gcc error : assignment from incompatible pointer type [enabled by default] : <p>I have the following function</p>

<pre><code>TreeNode* findParentNode(TreeNode *tn, int parentData, int branchSelect)
{
    ListNode *temp1, *temp2;

    if (tn-&gt;data == parentData)
    {
        if ((branchSelect == 0 &amp;&amp; tn-&gt;left == NULL) || (branchSelect == 1 &amp;&amp; tn-&gt;right == NULL))
            return tn;
    }
    if (tn-&gt;left == NULL &amp;&amp; tn-&gt;right == NULL)
        return NULL;



    temp1 = findParentNode(tn-&gt;left, parentData, branchSelect);
    if (temp1 != NULL)
        return temp1;

    temp2 = findParentNode(tn-&gt;right, parentData, branchSelect);
    if (temp2 != NULL)
        return temp2;
}
</code></pre>

<p>The function should return the parent node.<br>
it works well at vs but when I'm running it at gcc I'm getting the error above and I need it to work under gcc as well,
I read about this error but still I didn't find a way to fix it.</p>

<p>Can some1 help me fix it so I can run it at gcc as well?<br>
Thanks in advance.</p>
