diff options
author | 2023-05-10 19:24:43 +0200 | |
---|---|---|
committer | 2023-05-10 19:24:43 +0200 | |
commit | 89d843730b8da424b5790adcdf483efcd10fae3f (patch) | |
tree | 537d70563542b690ae793eaea26398195f4f7e1e | |
parent | a59862d7f52dcfc55c6db1e5dfabfab0e49cedeb (diff) | |
download | utils-89d843730b8da424b5790adcdf483efcd10fae3f.tar.gz utils-89d843730b8da424b5790adcdf483efcd10fae3f.zip |
Update README.md
-rw-r--r-- | README.md | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -8,3 +8,20 @@ Upcoming features: * maps - you can create maps with a key ad a value. The only limitation is the key must be a string. + +## Lists +### How to create a list +``` +list_t my_list = clist_create(); +``` +### How to add new data to a list +``` +char *my_data = "My data!"; +clist_add(&my_list, my_data, strlen(my_data) + 1); +``` +If you store strings, you can just use `strlen(char *) + 1`, but if you want use +other types of data, you can just do: +``` +struct my_struct *s1 = ... +clist_add(&my_list, s1, sizeof(s1)); +``` |