#include<stdio.h>
創(chuàng)新互聯(lián)公司專注于榆樹網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供榆樹營銷型網(wǎng)站建設(shè),榆樹網(wǎng)站制作、榆樹網(wǎng)頁設(shè)計、榆樹網(wǎng)站官網(wǎng)定制、微信小程序定制開發(fā)服務(wù),打造榆樹網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供榆樹網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
#include<stdlib.h>
#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<N;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);
}
分享標(biāo)題:帶頭結(jié)點(diǎn)的鏈表
當(dāng)前地址:http://chinadenli.net/article0/giegoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站、Google、營銷型網(wǎng)站建設(shè)、虛擬主機(jī)、網(wǎng)站建設(shè)、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)