• 链表实现--1


    #include "stdafx.h"

    typedef struct Node
    {
         struct Node* pre;
         char* data;
         struct Node* next;
    }LinkList;


    int init_list(LinkList** Lnode)    //初始始化
    {
         *Lnode = (LinkList*)malloc(sizeof(LinkList));
         if(*Lnode == NULL)
             return -1;
         (*Lnode)->data = NULL;
         (*Lnode)->next = NULL;
         (*Lnode)->pre = NULL;
         return 0;
    }


    int insert_list(LinkList* Lnode)   //添加节点
    {
         LinkList* p,*q;

        q =  Lnode->next;
         if(q == NULL)
         {
             q = Lnode;
         }
         else
         {
         while(q->next)
             q = q->next;
         }

        p = (LinkList*)malloc(sizeof(LinkList));
         if (p == NULL)
             return -1;
         p->data = (char*)malloc(sizeof(char)*1024);
         if (p->data == NULL)
             return -1;
         p->next = q->next;
         p->pre = q;
         q->next = p;
         return 0;
    }

  • 相关阅读:
    数据窗口的缓冲区
    RowsMove()
    update
    defparameter defconstant
    1+ 1
    原则
    incf decf
    eql equal
    上司找谈话
    判断回文的函数palindrome?
  • 原文地址:https://www.cnblogs.com/killad/p/7097067.html
Copyright © 2020-2023  润新知