SimCList是一个用来处理列表(List)的的高效C库。内置很多基于列表的算法,例如排序、查找、随机处理等等。
下面是一段使用SimCList的示例代码:
#include<stdio.h>#include<simclist.h>/*usetheSimCListlibrary*/intmain(){list_tmylist;/*declarealist*/intuserval;list_init(&mylist);/*initializethelist*/printf("Insertyournumber:");scanf("%d",&userval);list_append(&mylist,&userval);/*addanelementtothelist*/printf("Thelistnowholds%uelements.\n",\list_size(&mylist));/*getthesizeofthelist*/printf("Yournumberwas:%d\n",\*(int*)list_get_at(&mylist,0));/*extractthefirstelementofthelist*/list_destroy(&mylist);return0;}
评论