Skip to content

Instantly share code, notes, and snippets.

@siritori
Created February 6, 2012 06:35
Show Gist options
  • Save siritori/1750239 to your computer and use it in GitHub Desktop.
Save siritori/1750239 to your computer and use it in GitHub Desktop.
循環リスト
#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