?? hou_createlist.cpp
字號:
#include<stdio.h>
#include<malloc.h>
typedef struct node
{ int data;
struct node *next;
} Linklist;
void hou_Createlist(Linklist *&head,int n)
{ int i;
Linklist *p,*q;
head=(Linklist *)malloc(sizeof(Linklist));
head->next=NULL;
q=head;
for(i=0;i<n;i++)
{ p=(Linklist *)malloc(sizeof(Linklist));
scanf("%d",&(p->data));
q->next=p;
q=p;
}
q->next=NULL;
}
void print_list(Linklist *head)
{ Linklist *r;
r=head->next;
printf(" the result is: \n");
while(r!=NULL)
{ printf("%3d",r->data);
r=r->next;
}
printf("\n");
}
void main()
{ Linklist *a;
printf("hou_insert: \n");
hou_Createlist(a,5);
print_list(a);
getchar();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -