当前位置:网站首页>One way linked list implementation -- counting
One way linked list implementation -- counting
2022-06-23 13:32:00 【Jinxuehou column】
Realization of one-way linked list and metrological statistical function :
int16_t SingLinkList_Traverse(BOOKLT *bookHeadNode)
{
int16_t num = 0;// Count the number of books
BOOKLT * p = NULL; // Create a BOOKLT Pointer to structure type
p = bookHeadNode->next; //p Pointing to the head node next
if(NULL == p->next)// Only the head node
{
return -1;
}
while(p)//p->next Not empty , Continue traversing
{
printf("%s,%s,%d\r\n",p->bookInfo.ISBN,p->bookInfo.bookName,p->bookInfo.price);// Output the data field contents of each node
p = p->next;// Point to the next node
num++; // Traverse a node , Quantity plus 1
}
return num;
}main.c The function is implemented as follows :
int main()
{
int16_t num = 0;
BOOKLT *myBookHeadNode;// Define a BOOKLT A pointer to a header node of type
myBookHeadNode = SingLinkList_Create();// The above linked list memory has been released , Re create a header node
SingLinkList_TailInsert_method2(myBookHeadNode,sizeof(bookStock)/sizeof(BOOKINFO),bookStock);// Post insert method to insert nodes
SingLinkList_SelectSort(myBookHeadNode);// Select sort call
num = SingLinkList_Traverse(myBookHeadNode);// Traverse the one-way linked list and count the number of books
printf("\r\n The number of books is :%d\r\n",num);
SingLinkList_Destory(myBookHeadNode);// Release the memory of each node and the memory of the header node
return 0;
}Book information and Book measurement are as follows :

thus , The function of one-way linked list to count the number of books has been realized .
2022.06.19 junction .
边栏推荐
- #云原生征文#深入了解Ingress
- Stick to five things to get you out of your confusion!
- KDD 2022 | epileptic wave prediction based on hierarchical graph diffusion learning
- 那些技术实战中的架构设计方法
- 你管这破玩意儿叫 MQ?
- How to use androd gradle module dependency replacement
- 首次曝光!唯一全域最高等级背后的阿里云云原生安全全景图
- TUIKit 音视频低代码解决方案导航页
- 在线文本实体抽取能力,助力应用解析海量文本数据
- 腾讯的技术牛人们,是如何完成全面上云这件事儿的?
猜你喜欢

技术分享| WVP+ZLMediaKit实现摄像头GB28181推流播放

64 channel telephone +2-channel Gigabit Ethernet 64 channel PCM telephone optical transceiver voice telephone to optical fiber

64 channel PCM telephone optical transceiver 64 channel telephone +2-channel 100M Ethernet telephone optical transceiver 64 channel telephone PCM voice optical transceiver

Windows install MySQL

MySQL single database and table splitting using MYCAT

Common usage of OS (picture example)

MySQL使用ReplicationConnection導致的連接失效分析與解决

Gradle Build Cache引发的Task缓存编译问题怎么解决

Analysis and solution of connection failure caused by MySQL using replicationconnection

Go write permissions to file writefile (FileName, data, 0644)?
随机推荐
美国的国家公园概览
R language dplyr package mutate_ The all function multiplies all numeric columns (variables) in the dataframe by a fixed value to generate a new data column, and specifies a user-defined suffix name f
Esp32-c3 introductory tutorial problem ⑦ - fatal error: ESP_ Bt.h: no such file or directory ESP not found_ bt.h
在线文本实体抽取能力,助力应用解析海量文本数据
The R language inputs the distance matrix to the hclust function for hierarchical clustering analysis, uses the cutree function to divide the hierarchical clustering clusters, specifies the number of
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
KDD 2022 | epileptic wave prediction based on hierarchical graph diffusion learning
windows 安装 MySQL
How to solve the task cache compilation problem caused by gradle build cache
#yyds干货盘点# 解决剑指offer: 判断是不是平衡二叉树
Broadcast level E1 to aes-ebu audio codec E1 to stereo audio XLR codec
MySQL使用ReplicationConnection导致的连接失效分析与解决
In flinksql, the Kafka flow table and MySQL latitude flow table are left joined, and the association is made according to I'd. false
618's money saving technology strategy is coming - experience the scene and get a 10 yuan cat super card!
Packaging and unpacking process of ESP message under IPSec transmission mode
Has aaig really awakened its AI personality after reading the global June issue (Part 1)? Which segment of NLP has the most social value? Get new ideas and inspiration ~
Tt-slam: dense monocular slam for flat environment (IEEE 2021)
Online text filter less than specified length tool
AAIG看全球6月刊(上)发布|AI人格真的觉醒了吗?NLP哪个细分方向最具社会价值?Get新观点新启发~
【深入理解TcaplusDB技术】单据受理之事务执行