RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
带头结点的链表

#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://sczitong.cn/article/giegoo.html