test.c (320B)
1 #include <u.h> 2 #include <libc.h> 3 #include "util.h" 4 5 Type TestType = {sizeof(char *)}; 6 7 void 8 main(void) 9 { 10 Slice *buf = allocslice(&TestType, 0, 0); 11 char *str[] = { "hello", " ", "world", "\n" }; 12 sliceappendp(buf, 4, str); 13 int i; 14 for (i = 0; i < buf->len; i++) { 15 int *p = slicegetp(buf, i); 16 print("%s", *p); 17 } 18 }