rendered paste bodyenum
{
/* G, A, T, C, and N */
DNA_G,
DNA_A,
DNA_T,
DNA_C,
DNA_N
};
struct node {
int DNA;
struct node *next;
};
struct node *new_node()
{
struct node *node;
r = malloc(struct node);
if(!r)
return NULL;
r->next = NULL;
return r;
}
struct node *link_node(struct node *list, struct node *node)
{
for(;list->next;list=list->next);
list->next=node;
}
int main()
{
struct node *node1, *node2, *node3, *head;
node1=new_node();
node2=new_node();
node3=new_node();
head=node1;
node1->DNA=DNA_C;
node2->DNA=DNA_G;
node3->DNA=DNA_C;
link_node(head, node2);
link_node(head, node3);
}