Crayon Syntax Highlighter 是一款优秀的代码高亮插件,后台有详细的设置选项

而且它的前台界面也有一些按钮 比如可以用户自定义是否显示行号 还有复制按钮
下面是一段演示代码
#include <stdio.h>
#include <malloc.h>
typedef struct Node
{
int data;
struct Node * pnext;
}NODE, *PNODE;
struct Node * create_list(struct Node * phead);
void traverse_list(struct Node * phead);
int main(void)
{
struct Node * phead = NULL;
phead = create_list(phead);
traverse_list(phead);
return 0;
}
struct Node * create_list(struct Node * phead)
{
int n, i;
struct Node * ptail;
phead = (struct Node *)malloc(sizeof(struct Node));
ptail = phead;
printf("要输入几个节点:n = ");
scanf("%d", &n);
for (i = 0; i < n; i++)
{
ptail->pnext = (struct Node *)malloc(sizeof(struct Node));
ptail = ptail->pnext;
printf("请输入第%d个节点的值:", i+1);
scanf("%d", &ptail->data);
ptail->pnext = NULL;
}
return phead;
}
void traverse_list(struct Node * phead)
{
struct Node * p = phead->pnext;
while(p != NULL)
{
printf("%d ", p->data);
p = p->pnext;
}
}
经雅乐网测试 代码复制之后直接粘贴就可以运行咯
支付宝打赏
微信打赏