单链表建立
#include
#include
typedef struct node{
 int data;
 struct node *next;
}lnode;
#ifndef NULL
const int NULL=0;
#endif    // 定义NULL常量
void main(void)
{
 const int MAZ=100;
 lnode *head,*h;
 int n;
 cout<<"input the length of the linear:";
 cin>>n;
 cout<<'\n';
 head=(lnode *)malloc(sizeof(lnode));
 if(head==NULL)
 cout<<"memory has not accessed ! false";
 head->data=n;
 head->next=NULL;
 int i=1;
 h=head;
 while(i<=n)
    {
  lnode *s;
  s=(lnode *)malloc(sizeof(lnode));
     s->next=NULL;
    cout<<"input the "<  cin>>s->data;
     h->next=s;
  h=s;
 i++;
 }
    cout<<"output the linear_link datas :";
 h=head->next;
 while(h)
 {
     cout<< "address:"<data<    h=h->next;
 }
}