HELP,INFINIT LOOP ...简单的链接列表 [英] HELP, INFINIT LOOP... simple LINKED LIST

查看:48
本文介绍了HELP,INFINIT LOOP ...简单的链接列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是一个简单的链表程序。我认为DeleteNode函数是

产生一个无限循环,但我不知道在哪里..

#include< stdio.h>

typedef struct

{

char * str; // str是一个动态的字符数组

int length; //字符数

}字符串;


typedef结构节点

{

字符串数据;

struct node * Link;

} ListNode;


typedef struct listStuct

{

ListNode * Head;

}列表;


void AddNode(List * L,String item)

{

ListNode * currNode,* newNode;

currNode = L-> Head;

if(L-> Head = = NULL)

{

L-> Head =(ListNode *)malloc(sizeof(ListNode));

L-> Head-> Data = item;

L-> Head-> Link = NULL;

}

else

{

while(currNode-> Link!= NULL)

currNode = currNode-> Link; //转到最后一个

newNode =(ListNode *)malloc(sizeof(ListNode));

newNode-> Data = item;

newNode-> Link = NULL;

currNode-> Link = newNode;

}

}


void DeleteNode(List * L,String item)

{

ListNode * currNode,* prevNode;

currNode = L-> Head;

prevNode = L-> Head;

if(L-> Head == NULL)

{

printf("空列表");

}

while(currNode!= NULL)//检查是否第一次

{

if(strcmp(currNode-> Data.str,item.str)== 0)//找到

{

if(currNode == L-> Head)//第一个

{

L-> Head == currNode-> Link;

currNode-> Link = NULL;

free(currNode);

printf(" Remove First");

}

其他

{

prevNode-> Link = currNode->链接;

currNode - > Link = NULL;

免费( currNode);

printf("删除");

}

}

其他

{

prevNode = currNode;

currNode = currNode-> Link; //转到下一个

}

}

}

int main()

{

FILE * fp = NULL;

列表清单;

字符串字符串;

int i ;

int records = 0;

char filename [100];

//list.Head =(ListNode *)malloc(sizeof( ListNode));

list.Head = NULL;

string.str =(char *)malloc(sizeof(char)* 20);

printf(" Enter filename \\\
");

scanf("%s",filename);

fp = fopen(filename," r" ;);


if(fp == NULL)

{printf(" Error\ n);;

退出(0);

}

其他

{

fscanf(fp,"%d", (&=;记录);

for(i = 0; i< records; i ++)

{

fscanf(fp,"%s" ;,string.str);

AddNode(& list,string);

printf("%s",string.str);

}

printf(&\\; \ n \ n输入节点到删除:");

scanf("%s",string.str);

DeleteNode(& list,string);

}

返回1;

}

here''s a simple linked list program. the DeleteNode function is
producing an infinit loop i think, but i can''t figure out where..
#include <stdio.h>
typedef struct
{
char *str; //str is a dynamic array of characters
int length; //number of characters
} String;

typedef struct node
{
String Data;
struct node* Link;
} ListNode;

typedef struct listStuct
{
ListNode *Head;
}List;

void AddNode(List *L, String item)
{
ListNode *currNode, *newNode;
currNode = L->Head;
if (L->Head == NULL)
{
L->Head = (ListNode*)malloc(sizeof(ListNode));
L->Head->Data = item;
L->Head->Link = NULL;
}
else
{
while(currNode->Link != NULL)
currNode = currNode->Link; //go to the last
newNode = (ListNode*)malloc(sizeof(ListNode));
newNode->Data = item;
newNode->Link = NULL;
currNode->Link = newNode;
}
}

void DeleteNode(List *L, String item)
{
ListNode *currNode, *prevNode;
currNode = L->Head;
prevNode = L->Head;
if (L->Head == NULL)
{
printf("empty list");
}
while(currNode != NULL) //check if first
{
if(strcmp(currNode->Data.str,item.str)==0) //found
{
if(currNode == L->Head) //first one
{
L->Head == currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("Remove First");
}
else
{
prevNode->Link = currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("removed ");
}
}
else
{
prevNode = currNode;
currNode = currNode->Link; //go to next one
}
}
}
int main()
{
FILE *fp = NULL;
List list;
String string;
int i;
int records = 0;
char filename[100];
//list.Head = (ListNode*)malloc(sizeof(ListNode));
list.Head = NULL;
string.str = (char *)malloc(sizeof(char) *20);
printf("Enter filename\n");
scanf("%s", filename);
fp = fopen(filename, "r");

if (fp == NULL)
{ printf ("Error\n");
exit(0);
}
else
{
fscanf(fp, "%d", &records);
for (i = 0; i<records; i++)
{
fscanf(fp, "%s", string.str);
AddNode(&list, string);
printf("%s ", string.str);
}
printf("\n\nEnter a Node to delete: ");
scanf("%s", string.str);
DeleteNode(&list, string);
}
return 1;
}

推荐答案

na1paj写道:
这里是一个简单的链表程序。我认为DeleteNode函数产生了一个无限循环,但我无法弄清楚..

#include< stdio.h>
typedef struct
{
char * str; // str是一个动态的字符数组
int length; //字符数
}字符串;

typedef struct node
{String String数据;
struct node * Link;
} ListNode ;

typedef struct listStuct
{ListNode * Head;
}列表;


为什么要这么麻烦? (是的,这是一个样式问题,但只需要一个指向

`ListNode'的指针就足够了。额外的结构定义并不是真正的
添加任何东西。

void AddNode(List * L,String item)
{ListNode * currNode,* newNode;
currNode = L-> Head;
if(L-> Head == NULL)
{L /> Head =(ListNode *)malloc(sizeof(ListNode));
更好:

L-> Head = malloc(sizeof * L-> Head);

L-> Head-> Data = item;
L-> Head-> Link = NULL;
}

{
while(currNode-> Link!= NULL)
currNode = currNode-> Link; //转到最后一个
newNode =(ListNode *)malloc(sizeof(ListNode));


同样。

newNode-> Data = item;
newNode-> Link = NULL;
currNode-> Link = newNode;
}


void DeleteNode(List * L,String item)
{ListNode * currNode,* prevNode;
currNode = L - > Head;
prevNode = L-> Head;
if(L-> Head == NULL)
{/> printf(" empty list");
}
while(currNode!= NULL)//首先检查
{
if(strcmp(currNode-> Data.str,item.str)== 0) //找到
{
if(currNode == L-> Head)//第一个
{L /> Head == currNode-> Link;
currNode-> Link = NULL;
free(currNode);


好​​的。假设你到了这里。 'currNode'的价值是什么?

[提示:你甚至不允许看它。这样做,当你回到循环顶部时,你将会看到
,调用未定义的

行为。所以所有的赌注都已关闭。]

printf(删除第一个);
}

{
prevNode-> Link = currNode - > Link;
currNode-> Link = NULL;
free(currNode);
printf(" removed");
}
}

{
prevNode = currNode;
currNode = currNode-> Link; //转到下一个
}
}
}
int main()
{... FILE * fp = NULL; 字符串字符串;
int i;
int records = 0;
char filename [100];
//list.Head =(ListNode *)malloc(sizeof(ListNode));
list.Head = NULL;
string.str =(char *)malloc(sizeof(char)* 20);
printf("输入filename \ n");
scanf("%s",filename);
fp = fopen(filename," r");

if(fp == NULL)
{printf(" Error \ n);
退出(0);
}
其他
{
fscanf( fp,%d,& records);
for(i = 0; i< records; i ++)
{fscanf(fp,"%s",string。 str);
AddNode(& list,string);
printf("%s",string.str);
}
printf(" \ n \ n输入要删除的节点:");
scanf("%s",string.str);
DeleteNode(& list,string);
}
返回1;


嗯,这是一个非标准的回报值;更糟糕的是,非零回报

值表示*失败*。

}
here''s a simple linked list program. the DeleteNode function is
producing an infinit loop i think, but i can''t figure out where..
#include <stdio.h>
typedef struct
{
char *str; //str is a dynamic array of characters
int length; //number of characters
} String;

typedef struct node
{
String Data;
struct node* Link;
} ListNode;

typedef struct listStuct
{
ListNode *Head;
}List;
Why bother? (Yes, it''s a style issue, but having just a pointer to a
`ListNode'' would be sufficient. The extra struct definition doesn''t
really add anything.

void AddNode(List *L, String item)
{
ListNode *currNode, *newNode;
currNode = L->Head;
if (L->Head == NULL)
{
L->Head = (ListNode*)malloc(sizeof(ListNode)); Better:
L->Head = malloc( sizeof * L->Head );
L->Head->Data = item;
L->Head->Link = NULL;
}
else
{
while(currNode->Link != NULL)
currNode = currNode->Link; //go to the last
newNode = (ListNode*)malloc(sizeof(ListNode));
Similarly.
newNode->Data = item;
newNode->Link = NULL;
currNode->Link = newNode;
}
}

void DeleteNode(List *L, String item)
{
ListNode *currNode, *prevNode;
currNode = L->Head;
prevNode = L->Head;
if (L->Head == NULL)
{
printf("empty list");
}
while(currNode != NULL) //check if first
{
if(strcmp(currNode->Data.str,item.str)==0) //found
{
if(currNode == L->Head) //first one
{
L->Head == currNode->Link;
currNode->Link = NULL;
free(currNode);
OK. Suppose you get here. What''s the value of `currNode''?
[Hint: You''re not even allowed to look at it. Doing so, as you will
when you get back to the top of the loop, invokes undefined
behavior. So all bets are off.]
printf("Remove First");
}
else
{
prevNode->Link = currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("removed ");
}
}
else
{
prevNode = currNode;
currNode = currNode->Link; //go to next one
}
}
}
int main()
{
FILE *fp = NULL;
List list;
String string;
int i;
int records = 0;
char filename[100];
//list.Head = (ListNode*)malloc(sizeof(ListNode));
list.Head = NULL;
string.str = (char *)malloc(sizeof(char) *20);
printf("Enter filename\n");
scanf("%s", filename);
fp = fopen(filename, "r");

if (fp == NULL)
{ printf ("Error\n");
exit(0);
}
else
{
fscanf(fp, "%d", &records);
for (i = 0; i<records; i++)
{
fscanf(fp, "%s", string.str);
AddNode(&list, string);
printf("%s ", string.str);
}
printf("\n\nEnter a Node to delete: ");
scanf("%s", string.str);
DeleteNode(&list, string);
}
return 1;
Erm, that''s a non-standard return value; worse, a non-zero return
value indicates *failure*.
}




还有其他一些代码有问题,但我不会在这里进入

。但一般来说,你有特殊情况需要处理的事实通常表明你的设计比你需要的更复杂。\\ b
。考虑一下 - 如果你仍然遇到

麻烦,请务必重新发布。


HTH,

- ag

-

Artie Gold - 德克萨斯州奥斯汀

哦,对于常规老垃圾邮件的美好时光。



There are some other things wrong with the code, but I won''t go into
that here. In general, though, the fact that you have special cases
to deal with typically indicates that your design is more complex
than it needs to be. Think about that -- and if you still run into
trouble, by all means repost.

HTH,
--ag
--
Artie Gold -- Austin, Texas
Oh, for the good old days of regular old SPAM.


na1paj写道:
na1paj wrote:
这里是一个简单的链表程序。


这并不像你想象的那么简单。

DeleteNode函数产生一个无限循环我认为,但我可以'弄清楚在哪里..

#include< stdio.h>
typedef struct
{
char * str; // str是一个动态的字符数组


如果你有一个C99编译器,好的,没问题。你呢?如果没有,//是语法

错误。

int length; //字符数


您是否计划出于任何原因出现负数字?


实际上,您的代码似乎没有完全使用长度字段。

}字符串;

typedef struct node
{
字符串数据;
struct node * Link ; ListNode;

typedef struct listStuct
{ListNode * Head;
}列表;

void AddNode( List * L,String item)
{ListNode * currNode,* newNode;
currNode = L-> Head;
if(L-> Head == NULL)
{L /> Head =(ListNode *)malloc(sizeof(ListNode));


未定义的行为。你的编译器也会警告你,如果

只有你没有投入那个愚蠢的演员阵容。


将其改写为:


L-> Head = malloc(sizeof * L-> Head);


一般情况下,如果p是指向某个对象的指针类型,然后:


p = malloc(sizeof * p);

别忘了#include< stdlib.h>对于malloc原型(没有

,这就是上面代码中给你未定义的行为)。


L-> Head->数据=项目;


你忘了检查malloc的返回值,这很容易就是NULL

(意思是无法分配所请求的内存) )。如果是,则取消引用该指针(如此处所示)
调用未定义的行为。

L-> Head-> Link = NULL;
}

{
while(currNode-> Link!= NULL)
currNode = currNode-> Link; //转到最后一个
newNode =(ListNode *)malloc(sizeof(ListNode));


newNode = malloc(sizeof * newNode);


别忘了检查NULL。

newNode-> Data = item;
newNode-> Link = NULL;
currNode-> Link = newNode;
}
}
void DeleteNode(List * L,String item)
{ListNode * currNode,* prevNode;
currNode = L-> Head;
prevNode = L-> Head ;
if(L-> Head == NULL)
{
printf(空列表);
}
while(currNode!= NULL) //首先检查
{
if(strcmp(currNode-> Data.str,item.str)== 0)//找到
{
if(currNode = = L-> Head)//第一个
{L>> Head == currNode-> Link;
currNode-> Link = NULL;
免费(currNode);
printf(" Remove First");
}

{
prevNode-> Link = currNode-> Link;
currNode-> Link = NULL;
free(currNode);
printf(" removed");
}
}
else {
prevNode = currNode;
currNode = currNode-> Link; //转到下一个
}
}
}


我快速浏览了一下,但完全没有缩进使

代码非常难以理解,所以我放弃了。


int main()
{
FILE * fp = NULL;
列表列表;
字符串字符串;
int i;
int records = 0;
char filename [100];
// list .Head =(ListNode *)malloc(sizeof(ListNode));
list.Head = NULL;
string.str =(char *)malloc(sizeof(char)* 20);


string.str = malloc(20 * sizeof * string.str);


注意:20可能还不够。如果没有,你冒着缓冲区溢出攻击的风险。


测试是否为空。

printf("输入filename \ nn);;
scanf("%s",filename);


粗心或恶意用户造成缓冲区溢出攻击的危险。

fp = fopen(filename," r");
if(fp == NULL)
{printf(" Error \ n));
exit(0);


0表示成功。如果出错,我建议使用EXIT_FAILURE(这是另外一个很好的理由来#include< stdlib.h>)。

}

{
fscanf(fp,"%d",& records);
for(i = 0; i< records; i ++)
{
fscanf(fp,& ;%s",string.str);


可能发生缓冲区溢出。

AddNode(& list,string);
printf("%s",string.str );
}
printf(" \ n \ nn输入要删除的节点:");


在这里打印换行符或fflush(stdout);

scanf("%s",string.str);


可能发生缓冲区溢出。

DeleteNode(& list,string);
}
返回1;


返回EXIT_SUCCESS或返回0将是一个更好的主意。谷歌

档案作为解释。

}
here''s a simple linked list program.
It''s not as simple as you think.
the DeleteNode function is
producing an infinit loop i think, but i can''t figure out where..
#include <stdio.h>
typedef struct
{
char *str; //str is a dynamic array of characters
If you have a C99 compiler, okay, fine. Do you? If not, // is a syntax
error.
int length; //number of characters
Were you planning on having a negative number of characters for any reason?

In fact, your code seems not to use the length field at all.
} String;

typedef struct node
{
String Data;
struct node* Link;
} ListNode;

typedef struct listStuct
{
ListNode *Head;
}List;

void AddNode(List *L, String item)
{
ListNode *currNode, *newNode;
currNode = L->Head;
if (L->Head == NULL)
{
L->Head = (ListNode*)malloc(sizeof(ListNode));
Undefined behaviour. Your compiler would have warned you about it, too, if
only you hadn''t put in that stupid cast.

Rewrite this as:

L->Head = malloc(sizeof *L->Head);

In general, if p is a pointer to some object type, then:

p = malloc(sizeof *p);
Don''t forget to #include <stdlib.h> for the malloc prototype (the absence of
which is what gives you undefined behaviour in the above code).

L->Head->Data = item;
You forgot to check malloc''s return value, which could easily have been NULL
(meaning "couldn''t allocate the requested memory"). If it was, then
dereferencing that pointer (as you do here) invokes undefined behaviour.
L->Head->Link = NULL;
}
else
{
while(currNode->Link != NULL)
currNode = currNode->Link; //go to the last
newNode = (ListNode*)malloc(sizeof(ListNode));
newNode = malloc(sizeof *newNode);

Don''t forget to check for NULL.
newNode->Data = item;
newNode->Link = NULL;
currNode->Link = newNode;
}
}

void DeleteNode(List *L, String item)
{
ListNode *currNode, *prevNode;
currNode = L->Head;
prevNode = L->Head;
if (L->Head == NULL)
{
printf("empty list");
}
while(currNode != NULL) //check if first
{
if(strcmp(currNode->Data.str,item.str)==0) //found
{
if(currNode == L->Head) //first one
{
L->Head == currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("Remove First");
}
else
{
prevNode->Link = currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("removed ");
}
}
else
{
prevNode = currNode;
currNode = currNode->Link; //go to next one
}
}
}
I had a quick look at this, but the complete absence of indentation made the
code very hard to follow, so I gave up.



int main()
{
FILE *fp = NULL;
List list;
String string;
int i;
int records = 0;
char filename[100];
//list.Head = (ListNode*)malloc(sizeof(ListNode));
list.Head = NULL;
string.str = (char *)malloc(sizeof(char) *20);
string.str = malloc(20 * sizeof *string.str);

Note: 20 may not be enough. If not, you risk a buffer overrun attack.

Test for NULL.
printf("Enter filename\n");
scanf("%s", filename);
Danger of buffer overrun attack by careless or malicious user.
fp = fopen(filename, "r");

if (fp == NULL)
{ printf ("Error\n");
exit(0);
0 indicates success. On error, I suggest using EXIT_FAILURE (which is
another good reason to #include <stdlib.h>).
}
else
{
fscanf(fp, "%d", &records);
for (i = 0; i<records; i++)
{
fscanf(fp, "%s", string.str);
Buffer overrun may occur.
AddNode(&list, string);
printf("%s ", string.str);
}
printf("\n\nEnter a Node to delete: ");
Either print a newline here or fflush(stdout);
scanf("%s", string.str);
Buffer overrun may occur.
DeleteNode(&list, string);
}
return 1;
return EXIT_SUCCESS or return 0 would be a much better idea. Google the
archives for an explanation.
}




-

Richard Heathfield: bi****@eton.powernet.co.uk

Usenet是一个奇怪的地方。 - Dennis M Ritchie,1999年7月29日。

C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

K& R答案,C书等:< a rel =nofollowhref =http://users.powernet.co.uk/etontarget =_ blank> http://users.powernet.co.uk/eton



--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton


na1paj写道:
这里是一个简单的链表程序。我认为DeleteNode函数产生了一个无限循环,但我无法弄清楚..


其他海报已经指出了一些错误。还有更多。

#include< stdio.h>


#include< string.h>

#include< stdlib.h>

typedef struct
{
char * str; // str是一个动态的字符数组
int length; //字符数
}字符串;

typedef struct node
{String String数据;
struct node * Link;
} ListNode ;

typedef struct listStuct
{ListNode * Head;
}列表;

void AddNode(List * L,String item)
{ListNode * currNode,* newNode;
currNode = L-> Head;
if(L-> Head == NULL)
{
L-> Head =(ListNode *)malloc(sizeof(ListNode));
L-> Head-> Data = item;
L-> Head-> Link = NULL;
}

{
while(currNode-> Link!= NULL)
currNode = currNode-> Link; //转到最后一个
newNode =(ListNode *)malloc(sizeof(ListNode));
newNode-> Data = item;
newNode-> Link = NULL;
currNode-> Link = newNode;
}

void DeleteNode(List * L,String item)
{ListNode * currNode ,* prevNode;
currNode = L-> Head;
prevNode = L-> Head;
if(L-> Head == NULL)
{
printf(空列表);
}
while(currNode!= NULL)//首先检查
{
if(strcmp(currNode-> Data) .str,item.str)== 0)//找到
{
if(currNode == L-> Head)//第一个
{
L-> ; Head == currNode-> Link;


L-> Head = currNode-> Link;

currNode-> Link = NULL;
free(currNode);
printf(" Remove First");
}

{/ / / prevNode-> Link = currNode-> Link;
currNode-> ; Link = NULL;
free(currNode);
printf(" removed");
}


break;

}
其他
{
prevNode = currNode;
currNode = currNode-> Link; //转到下一个
}
}
}
int main()
{... FILE * fp = NULL; 字符串字符串;
int i;
int records = 0;
char filename [100];
//list.Head =(ListNode *)malloc(sizeof(ListNode));
list.Head = NULL;
string.str =(char *)malloc(sizeof(char)* 20);
printf("输入filename \ n");
scanf("%s",filename);
fp = fopen(filename," r");

if(fp == NULL)
{printf(" Error \ n);
退出(0);
}
其他
{
fscanf( fp,%d,& records);
for(i = 0; i< records; i ++)
{fscanf(fp,"%s",string。 str);
AddNode(& list,string);
printf("%s",string.str);
}
printf(" \ n \ n输入要删除的节点:");
scanf("%s",string.str);


这是真正的问题。你的String结构包含一个指向

的字符数组。当添加一个节点时,你复制结构,并且因此指针就是
,所以每个节点都指向你在main上面分配的
的缓冲区。包括你使用的字符串结构

作为删除键。

DeleteNode(& list,string);
}
返回1;
}
here''s a simple linked list program. the DeleteNode function is
producing an infinit loop i think, but i can''t figure out where..
Other posters have already pointed out some errors. Here are more.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
char *str; //str is a dynamic array of characters
int length; //number of characters
} String;

typedef struct node
{
String Data;
struct node* Link;
} ListNode;

typedef struct listStuct
{
ListNode *Head;
}List;

void AddNode(List *L, String item)
{
ListNode *currNode, *newNode;
currNode = L->Head;
if (L->Head == NULL)
{
L->Head = (ListNode*)malloc(sizeof(ListNode));
L->Head->Data = item;
L->Head->Link = NULL;
}
else
{
while(currNode->Link != NULL)
currNode = currNode->Link; //go to the last
newNode = (ListNode*)malloc(sizeof(ListNode));
newNode->Data = item;
newNode->Link = NULL;
currNode->Link = newNode;
}
}

void DeleteNode(List *L, String item)
{
ListNode *currNode, *prevNode;
currNode = L->Head;
prevNode = L->Head;
if (L->Head == NULL)
{
printf("empty list");
}
while(currNode != NULL) //check if first
{
if(strcmp(currNode->Data.str,item.str)==0) //found
{
if(currNode == L->Head) //first one
{
L->Head == currNode->Link;
L->Head = currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("Remove First");
}
else
{
prevNode->Link = currNode->Link;
currNode->Link = NULL;
free(currNode);
printf("removed ");
}
break;
}
else
{
prevNode = currNode;
currNode = currNode->Link; //go to next one
}
}
}
int main()
{
FILE *fp = NULL;
List list;
String string;
int i;
int records = 0;
char filename[100];
//list.Head = (ListNode*)malloc(sizeof(ListNode));
list.Head = NULL;
string.str = (char *)malloc(sizeof(char) *20);
printf("Enter filename\n");
scanf("%s", filename);
fp = fopen(filename, "r");

if (fp == NULL)
{ printf ("Error\n");
exit(0);
}
else
{
fscanf(fp, "%d", &records);
for (i = 0; i<records; i++)
{
fscanf(fp, "%s", string.str);
AddNode(&list, string);
printf("%s ", string.str);
}
printf("\n\nEnter a Node to delete: ");
scanf("%s", string.str);
Here is the real problem. Your String structure contains a pointer to
an array of chars. When adding a node, you copy the structure, and
hence the pointer, so every node is pointing to the buffer you
allocated above in main. Including the String structure you are using
as the key to delete.
DeleteNode(&list, string);
}
return 1;
}






这篇关于HELP,INFINIT LOOP ...简单的链接列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆