All pastes #747808 Raw Edit

Miscellany

public c v1 · immutable
·published 2007-10-24 11:23 UTC
rendered paste body
#include <stdio.h>struct rn {int dice;struct rn *next;};typedef struct rn item;int main() {item *cur, *prev, *t, *last;prev=NULL;int i;for (i=0; i<10; i++){        printf("%d\n",i);        cur=malloc(sizeof(item));        cur->dice=i;        cur->next=prev;        prev=cur;}last = cur;while(cur) {        printf("!%d\n",cur->dice);        if ((cur->dice)%2) {                t=cur->next;                if (t==NULL) {break;}                cur->next = t->next;                cur=t->next;                free(t);}        else { cur=cur->next; }}cur=last;while(cur) {        printf("!!!%d\n",cur->dice);        cur=cur->next;}}