Advertisement

计算与分析这两个步骤对于该列表来说

阅读量:

统计链表节点个数和链表查找

首先需要确立链表数据结构的定义,并构建相应的结构体。

复制代码
    struct Test
    {
        int data;
        struct Test *next;
    };
    
    
    
      
      
      
      
      
      
    

构建一个静态链表

复制代码
    struct Test t1 = {1,NULL};
        struct Test t2 = {2,NULL};
        struct Test t3 = {3,NULL};
        struct Test t4 = {4,NULL};
        struct Test t5 = {5,NULL};
    
        t1.next = &t2;
        t2.next = &t3;
        t3.next = &t4;
        t4.next = &t5;
    
        struct Test *head;
        head=&t1;
    
    
      
      
      
      
      
      
      
      
      

全部评论 (0)

还没有任何评论哟~