SHARE
TWEET

Untitled

a guest Feb 25th, 2010 437 Never
  1. #include "ilist_destructive.h"
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4.  
  5. int main(void){
  6.    ilist il = iempty();
  7.    il = icons_destroy(1, il);
  8.    il = icons_destroy(2, il);
  9.    il = icons_destroy(3, il);
  10.    il = icons_destroy(4, il);
  11.    ilist il2 = icopy(il);
  12.    ilist temp2 = il2;
  13.    while (!iempty_huh(il2)){
  14.      printf("%d\n", ifirst(il2));
  15.      il2 = irest(il2);
  16.      }
  17.    ilist temp = il;
  18.    while (!iempty_huh(il)){
  19.      printf("%d\n", ifirst(il));
  20.      il = irest(il);
  21.      }
  22.      idelete(temp);
  23.      idelete(temp2);
  24.   ilist l1 = iempty();
  25.   ilist l2 = iempty();
  26.   l1 = icons_destroy(4, l1);
  27.   l1 = icons_destroy(3, l1);
  28.   l1 = icons_destroy(2, l1);
  29.   l1 = icons_destroy(1, l1);
  30.   l2 = icons_destroy(8, l2);
  31.   l2 = icons_destroy(7, l2);
  32.   l2 = icons_destroy(6, l2);
  33.   l2 = icons_destroy(5, l2);
  34.   ilist l3 = iappend_destroy(l1, l2);
  35.   ilist temp3 = l3;
  36.   while (!iempty_huh(l3)){
  37.      printf("%d\n", ifirst(l3));
  38.      l3 = irest(l3);
  39.      }
  40.    idelete(temp3);
  41.    return 0;
  42.      }
RAW Paste Data
Top