执行deleteNode(headNode, local)后,nextNode结点指向的地址值被改变了;其中deleteNode功能是删除headNode中的local信息
struct Node* deleteFileSameInfo(struct Node* headNode)
{
struct Node* nextNode = headNode->next;
if (nextNode == NULL)
{
return;
}
int i;
struct Node* frontNode = headNode;
while (frontNode != NULL)
{
char* local = frontNode->data.num;
nextNode = frontNode->next;
while (nextNode != NULL)
{
for (i = 0; i < strlen(local); i++)
{
if (local[i] != nextNode->data.num[i])
{
break;
}
}
if (i == strlen(local))
{
printf("发现相同工号(%s),", local);
deleteNode(headNode, local);
}
i = 0;
nextNode = nextNode->next;
}
frontNode = frontNode->next;
}
return headNode;
}