FindNode函数
This commit is contained in:
parent
62dbc1548d
commit
53b9d47f3c
25
src/rail.c
25
src/rail.c
|
@ -39,4 +39,27 @@ rail_node_t *CreateRails(int length, int node_num)
|
|||
head->last_node = node;
|
||||
|
||||
return head;
|
||||
}
|
||||
}
|
||||
|
||||
rail_node_t *FindNode(rail_node_t *rails, int id)
|
||||
{
|
||||
rail_node_t *p = NULL;
|
||||
if(rails)
|
||||
{
|
||||
if(rails->id == id)
|
||||
{
|
||||
return rails;
|
||||
}
|
||||
if(rails->next_node != NULL)
|
||||
{
|
||||
p = FindNode(rails->next_node, id);
|
||||
if(p)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user