Created
February 6, 2012 06:35
-
-
Save siritori/1750239 to your computer and use it in GitHub Desktop.
循環リスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct node { | |
int data; | |
struct node *next; | |
}; | |
int main(void) { | |
struct node a, b, c, d; | |
a.next = &b; | |
b.next = &c; | |
c.next = &d; | |
d.next = &a; | |
a.data = 1; | |
b.data = 2; | |
c.data = 3; | |
d.data = 4; | |
for(struct node *p = &a; ; p = p->next) { | |
printf("%p : %d¥n", p, p->data); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment