📄 5-6.c
字号:
#include <stdio.h>
typedef char datatype;
typedef struct node{
datatype data;
struct node *next;
} listnode;
typedef listnode *linklist;
listnode *p;
linklist createlist(void)
{
char ch;
linklist head;
listnode *p;
head=NULL;//初始化为空
ch=getchar( );
while (ch!='\n'){
p=(listnode*)malloc(sizeof(listnode));/*分配空间*/
p->data=ch;/*数据域赋值*/
p->next=head;/*指定后继指针*/
head=p;/*head指针指定到新插入的结点上*/
ch=getchar( );
}
return (head);
}
listnode * locatenode(linklist head,char key)
{
listnode * p=head->next;
while( p && p->data!=key)
p=p->next;
return p;
}
main()
{
linklist list;
listnode * node;
char key='c';
list=createlist();
node=locatenode(list,key);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -