链表、遍历链表

#include
#include
#include
typedef struct AA
{
 int id;
 char* name;
 char* tel;
 struct AA *pNext;
}Node;
int main()
{
 Node a={1,"佩奇","11",NULL};
 Node b={2,"苏西","22",NULL};
 Node c={3,"丹尼","33",NULL};
 Node d={4,"佩德罗","44",NULL};
 a.pNext = &b;
 b.pNext = &c;
 c.pNext = &d;
 return 0;
}

遍历链表

#include
#include
#include
typedef struct AA
{
 int id;
 char* name;
 char* tel;
 struct AA *pNext;
}Node;
int main()
{
 Node a={1,"佩奇","11",NULL};
 Node b={2,"苏西","22",NULL};
 Node c={3,"丹尼","33",NULL};
 Node d={4,"佩德罗","44",NULL};
 Node* p=&a;
 a.pNext = &b;
 b.pNext = &c;
 c.pNext = &d;
 while(p != NULL)
 {
  printf("%d %s %s\n",p->id,p->name,p->tel);
  p=p->pNext;
 }
 return 0;
}

你可能感兴趣的:(new,point)