标签:io sp c amp ef r bs type as
#include <stdio.h>//单向循环链表实现与遍历
typedef struct Node {
int data;
struct Node *next;
} Node;
int main ()
{
Node n1 = {1, NULL};
Node n2 = {2, NULL};
Node n3 = {3, NULL};
Node n4 = {4, NULL};
n1.next = &n2;
n2.next = &n3;
n3.next = &n4;
n4.next = &n1;
Node *pn = &n1;
do {
printf("%d\n", pn->data);
pn = pn->next;
} while(pn != &n1);
return 0;
}
#include <stdio.h>//单向链表实现与遍历
typedef struct Node {
int data;
struct Node *next;
} Node;
int main ()
{
Node n1 = {1, NULL};
Node n2 = {2, NULL};
Node n3 = {3, NULL};
Node n4 = {4, NULL};
n1.next = &n2;
n2.next = &n3;
n3.next = &n4;
Node *pn = &n1;
while(pn!=NULL)
{
printf("%d",pn->data);
pn=pn->next;
}
return 0;
}
标签:io sp c amp ef r bs type as
原文地址:http://www.cnblogs.com/a514875560/p/3991579.html