insert(char * key, struct node *leaf, int x)
{
if (x==1) //Customer
{
if( strcmp(leaf->customer.IDNo,root->customer.IDNo)==0 )
{
*leaf = (struct node) malloc(101);
*leaf->customer.IDNo = key;
/* initialize the children to null */
(*leaf)->left = 0;
(*leaf)->right = 0;
}
else if(strcmp(key,(*leaf)->customer.IDNo)<0)
{
insert( key, &(*leaf)->left );
}
else if(strcmp(key,(*leaf)->customer.IDNo)>0)
{
insert( key, &(*leaf)->right );
}
}
else //Product
{
if( strcmp(leaf->product.ProdName,root->product.ProdName)==0 )
{
*leaf = (struct node) malloc(101);
(*leaf)->product.ProdName = key;
/* initialize the children to null */
(*leaf)->left = 0;
(*leaf)->right = 0;
}
else if(strcmp(key,(*leaf)->product.ProdName)<0)
{
insert( key, &(*leaf)->left );
}
else if(strcmp(key,(*leaf)->product.ProdName)>0)
{
insert( key, &(*leaf)->right );
}
}
}
45,64 转换为非标量类型请求 46 赋值从没有强制转换的指针生成整数 48,49,51,53,55,57,65,67,68,70,72,74,76 无效类型参数 - >(有结构节点)53、57、72、76 函数“插入”的参数太少
Node *search(char * key, struct node *leaf,int x)
{
struct node * y;
if (x==1)
{
if( leaf != 0 )
{
if(strcmp(key,leaf->customer.IDNo)==0)
{
y= leaf;
}
else if(strcmp(key,leaf->customer.IDNo)<0)
{
y= search(key, leaf->left);
}
else
{
y= search(key, leaf->right);
}
}
}
else if (x==2)
{
if( leaf != 0 )
{
if(strcmp(key,leaf->product.ProdName)==0)
{
y= leaf;
}
else if(strcmp(key,leaf->product.ProdName)<0)
{
y= search(key, leaf->left);
}
else
{
y= search(key, leaf->right);
}
}
}
else y= 0;
return y;
}
94,98,112 函数“搜索”的参数太少
多行发生的错误是相似的,所以我需要的只是有关如何修复其中一个错误的说明,其余的我可以完成。