#include<stdio.h>
#include<stdlib.h>
typedef struct Node_{
int data;
struct Node_* pNext;
}Node;
typedef struct LinkList_{
Node* pHead;
Node* pTail;
}LinkNode, *LinkList;
LinkList createLinkList();
void addNode(LinkList ll, int x);
void main(){
LinkList ll = createLinkList();
//createLinkList(ll);
addNode(ll, 1);
addNode(ll, 2);
addNode(ll, 3);
printf("traverse \n");
Node* p = ll->pHead->pNext;
while(p->pNext != NULL){
printf("value is %d\n", p->data);
p = p->pNext;
}
printf("value is %d", p->data);
system("pause");
return;
};
LinkList createLinkList(){
LinkList ll = new LinkNode();
Node* head = new Node();
head->data = -1;
head->pNext = NULL;
ll->pHead = head;
ll->pTail = head;
return ll;
}
void addNode(LinkList ll, int x){
Node* n = new Node();
n->data = x;
n->pNext = NULL;
ll->pTail->pNext = n;
ll->pTail = n;
}
#include<stdlib.h>
typedef struct Node_{
int data;
struct Node_* pNext;
}Node;
typedef struct LinkList_{
Node* pHead;
Node* pTail;
}LinkNode, *LinkList;
LinkList createLinkList();
void addNode(LinkList ll, int x);
void main(){
LinkList ll = createLinkList();
//createLinkList(ll);
addNode(ll, 1);
addNode(ll, 2);
addNode(ll, 3);
printf("traverse \n");
Node* p = ll->pHead->pNext;
while(p->pNext != NULL){
printf("value is %d\n", p->data);
p = p->pNext;
}
printf("value is %d", p->data);
system("pause");
return;
};
LinkList createLinkList(){
LinkList ll = new LinkNode();
Node* head = new Node();
head->data = -1;
head->pNext = NULL;
ll->pHead = head;
ll->pTail = head;
return ll;
}
void addNode(LinkList ll, int x){
Node* n = new Node();
n->data = x;
n->pNext = NULL;
ll->pTail->pNext = n;
ll->pTail = n;
}