SimCList 是一个用来处理列表(List)的的高效C库。内置很多基于列表的算法,例如排序、查找、随机处理等等。
下面是一段使用SimCList的示例代码:
#include <stdio.h> #include <simclist.h> /* use the SimCList library */ int main() { list_t mylist; /* declare a list */ int userval; list_init(& mylist); /* initialize the list */ printf("Insert your number: "); scanf("%d", & userval); list_append(& mylist, & userval); /* add an element to the list */ printf("The list now holds %u elements.\n", \ list_size(& mylist)); /* get the size of the list */ printf("Your number was: %d\n", \ * (int*)list_get_at(& mylist, 0)); /* extract the first element of the list */ list_destroy(&mylist); return 0; }