那位高手能帮我加入注释

来源:百度知道 编辑:UC知道 时间:2024/06/04 17:50:12
/*char1_1.c Create two node */
#define Null 0
#include "malloc.h";
#include "stdio.h";
#include "string.h";
void main()
{struct linklist
{char data;
struct linklist *next;
};
struct linklist varbody,*head,*s;
char x,y;
scanf("%c%c",&x,&y);
head=(struct linklist*)malloc(sizeof(varbody));
s=(struct linklist*)malloc(sizeof(varbody));
head->next=s;
s->next=Null;
head->data=x;
s->data=y;
printf("head->data=%c,s->data=%c",head->data,s->data);
}

数据结构的问题:
<br>#define Null 0 /*定义null=0*/
<br>#include "malloc.h";
<br>#include "stdio.h";
<br>#include "string.h"; /*调用函数*/
<br>void main()
<br>{struct linklist
<br>{char data;
<br>struct linklist *next;
<br>}; /*定义结构,内含data和指针next*/
<br>struct linklist varbody,*head,*s; /*定义varbody和2个指针*/
<br>char x,y; /*定义字符型x和y*/
<br>scanf("%c%c",&x,&y); /*输入x和y*/
<br>head=(struct linklist*)malloc(sizeof(varbody));
<br>s=(struct linklist*)malloc(sizeof(varbody));
/*为head和s申请空间*/
<br>head->next=s; /*s为head的后指针*/
<br>s->next=Null; /*s后指针为空,即s指向的单元为最后一个*/
<br>head->data=x; /*head指向的值为输入的x*/
<br>s->data=y; /*s指向的值为输入的y*/
<br>printf("head->data=%c,s->data=%c",head->data,s->data);
<br>}/*输出x