Skip to content

Commit

Permalink
Merge pull request zhayujie#5 from illyber/mybranch
Browse files Browse the repository at this point in the history
为了消除errors和warnings,给C-Primer-Plus/Chapter_17/8pet/pet.c里的SeekItem,
  • Loading branch information
zhayujie authored Feb 7, 2023
2 parents 01d5843 + 5c62678 commit ca44759
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Chapter_17/8pet/pet.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ typedef struct pair {
static int count = 0;

//局域函数声明
static Pair SeekItem(const Tree * ptree, Item * pi);
static int ToLeft(Item * p1, Item * p2);
static int ToRight(Item * p1, Item * p2);
static Trnode * MakeNode(Item * item);
static Pair SeekItem(const Tree * ptree, const Item * pi);
static int ToLeft(const Item * p1, const Item * p2);
static int ToRight(const Item * p1, const Item * p2);
static Trnode * MakeNode(const Item * item);
static void AddNode(Trnode * new_node, Trnode * root);
static void DeleteNode(Trnode * * ptr);
static void InOrder(Trnode * root, void (*pfun)(Item item));
Expand Down Expand Up @@ -181,7 +181,7 @@ static Pair SeekItem(const Tree * ptree, const Item * pi)
}

//项在左边
static int ToLeft(Item * p1, Item * p2)
static int ToLeft(const Item * p1, const Item * p2)
{
if (strcmp(p1->name, p2->name) < 0)
return 1;
Expand All @@ -190,15 +190,15 @@ static int ToLeft(Item * p1, Item * p2)
}

//项在右边
static int ToRight(Item * p1, Item * p2)
static int ToRight(const Item * p1, const Item * p2)
{
if (strcmp(p1->name, p2->name) > 0)
return 1;
else
return 0;
}

static Trnode * MakeNode(Item * item)
static Trnode * MakeNode(const Item * item)
{
Trnode * pnode;

Expand Down

0 comments on commit ca44759

Please sign in to comment.