Just wondering if I am making some stupid mistake or its Xcode.
I have typedef of a struct and now while comparing the pointer between two variable of same type, creates a incompatible pointer in Xcode but not in linux. Could any one please let me know whats going on here.
typedef struct Node
{
// treeNode has a hidden Address
int size;
struct treeNode *left;
struct treeNode *right;
} treeNode;
treeNode* FindMin(treeNode *node)
{
if(node==NULL)
{
return node;
}
if(node->left)
return FindMin(node->left); // Error :- treeNode is incompatible with Node
else
return node;
}
// If I type cast it .. Show no sign of error..
treeNode* FindMin(treeNode *node)
{
if(node==NULL)
{
/* There is no element in the tree */
return node;
}
if(node->left)
return FindMin((struct Node *)node->left); // No Error here
else
return node;
}