#include<stdio.h>#include<stdlib.h>typedefint DataType;structNode{DataType data;structNode* next;};typedefstructNode*PNode;typedefstructNode*LinkList; LinkList SetNullList_Link()//设置头结点{LinkList head =(LinkList)malloc(sizeof(structNode));if(head !=NULL) head->next =NULL;elseprintf("alloc failure");return head;}voidCreateList_Tail(structNode* head)//利用尾插法{PNode p =NULL;PNode q = head;DataType data;scanf("%d",&data);while(data !=-1){ p =(structNode*)malloc(sizeof(structNode));p->data = data;p->next =NULL;q->next = p;q = p;scanf("%d",&data);}}intInserch_num(LinkList head,int x)//找值 {LinkList p;int i=0;p=head->next;while(p)//把前后特殊情况单列出来 {if(i==0&&p->data==x){printf("The Prodrove node is head,the position of the rear node is at position 2 of the linked list\n");return0;}if(p->data==x&&p->next==NULL){printf("The Prodrove node is %d,there is no rear node\n ",i);return0;}if(p->data==x){printf("The Prodrove node is %d,he rear node is %d\n",i,i+2);return0;}i++;p = p->next;}return0;}voidprint(LinkList head)//打印{PNode p = head->next;while(p){printf("%d ", p->data);p = p->next;}}voidDestoryList_Link(LinkList head)//销毁链表{PNode pre = head; PNode p = pre->next;while(p){free(pre);pre = p;p = pre->next;}free(pre);}intmain(){LinkList head =NULL;int x=0,a=0;head =SetNullList_Link();CreateList_Tail(head);print(head);printf("\n");printf("Please input the number you find:");scanf("%d",&x);a=x;Inserch_num(head,a);DestoryList_Link(head);return0;}
CAN(Controller Area Network)总线是一种广泛应用于汽车和工业领域的通信协议,用于实时数据传输和设备之间的通信。而虹科的PCAN-Explorer 6软件是一款功能强大的CAN总线分析工具,为开发人员提供了丰富的功能和灵活性。本文将重点…
问题背景
Maven项目构建时报错如下,
[ERROR] Malformed \uxxxx encoding.
[ERROR] java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re…
创建完成后的web.xml 文件,版本太低
<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" ><web-app><display-name>Archetype Created Web Appl…
Go流程控制与快乐路径原则 文章目录 Go流程控制与快乐路径原则一、流程控制基本介绍二、if 语句2.1 if 语句介绍2.2 单分支结构的 if 语句形式2.3 Go 的 if 语句的特点2.3.1 分支代码块左大括号与if同行2.3.2 条件表达式不需要括号 三、操作符3.1 逻辑操作符3.2 操作符的优先级…