處理列表(List)的的高效C語言庫 SimCList
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;
}
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!