带头结点的链表

#include

创新互联公司专注于榆树网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供榆树营销型网站建设,榆树网站制作、榆树网页设计、榆树网站官网定制、微信小程序定制开发服务,打造榆树网络公司原创品牌,更为您提供榆树网站排名全网营销落地服务。

#include

#define N 9

typedef struct node{

   int  data;

   struct node * next;

}ElemSN;

ElemSN  * Createlink(int a[],int n){ 

    int i;

    ElemSN * h, * p;

    h=p=(ElemSN *)malloc(sizeof(ElemSN));

            h->next=NULL;

            for( i=0;i

                  p=p->next=(ElemSN *)malloc(sizeof(ElemSN));

          p->data =a[i];

          p->next=NULL;

     }

return h;

   }

   void printlink(ElemSN * h){

       ElemSN * p;

       for(p=h;p->next;p=p->next)

   printf("%2d\n",p->next->data);

      }    

    int main(void){    

int a[N]={1,2,3,4,5,6,7,8,9};

ElemSN * head;

        head=Createlink(a,9);

printlink(head);

    }


网页标题:带头结点的链表
网站链接:http://lszwz.com/article/giegoo.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款