Skip to content

Instantly share code, notes, and snippets.

@draftcode
Created September 6, 2010 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draftcode/567108 to your computer and use it in GitHub Desktop.
Save draftcode/567108 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
struct list {
int val;
struct list *next;
};
struct list *newlist()
{
struct list l;
l.val = 0;
l.next = NULL;
return &l;
}
int main(void)
{
struct list *p = newlist();
p->val = 10;
p->next = newlist();
p->next->val = 20;
printf("%d %d¥n", p->val, p->next->val);
return 0;
}
@varInt
Copy link

varInt commented Sep 6, 2010

good \o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment