From 2bd0c8f5983e954b25ad9b603229e84d675946b8 Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 11 May 2024 14:53:25 +0200 Subject: readme --- Makefile | 4 ++-- README | 5 +++++ cd_linkedlist.c | 4 ++-- cs_linkedlist.c | 4 ++-- d_linkedlist.c | 4 ++-- s_linkedlist.c | 4 ++-- 6 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 README diff --git a/Makefile b/Makefile index 0b4e7c0..f03a4a1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -CC=egcc +CC=cc CFLAGS_TESTBIN=-O3 -Wfatal-errors -Wall -Werror -Wextra -g -Wpedantic -std=c99 -CFLAGS=-O3 -flto -march=native -DNDEBUG -fomit-frame-pointer -s -std=gnu99 +CFLAGS=-O3 -flto -march=native -DNDEBUG -fomit-frame-pointer -s -std=c99 TARGET1=s_linkedlist TARGET2=d_linkedlist TARGET3=cs_linkedlist diff --git a/README b/README new file mode 100644 index 0000000..256061b --- /dev/null +++ b/README @@ -0,0 +1,5 @@ +Linked lists examples + +I mainly did this to learn how they worked + +Please excuse the horrible makefile diff --git a/cd_linkedlist.c b/cd_linkedlist.c index 4e0d741..fc7df88 100644 --- a/cd_linkedlist.c +++ b/cd_linkedlist.c @@ -14,7 +14,7 @@ struct waster { struct waster *next; }; -struct waster *newnode () { +struct waster *newnode (void) { struct waster *new = malloc(sizeof(struct waster)); return new; @@ -62,7 +62,7 @@ void freellist(struct waster *wr1) { } } -int main () { +int main (void) { uint64_t passes = 4; uint64_t passstep = 1; diff --git a/cs_linkedlist.c b/cs_linkedlist.c index 657aeb8..1361ad0 100644 --- a/cs_linkedlist.c +++ b/cs_linkedlist.c @@ -13,7 +13,7 @@ struct waster { struct waster *next; }; -struct waster *newnode () { +struct waster *newnode (void) { struct waster *new = malloc(sizeof(struct waster)); return new; @@ -50,7 +50,7 @@ void freellist(struct waster *wr1) { } } -int main () { +int main (void) { uint64_t passes = 4; // 1 pass = the whole linked list. So 4 passes would be to print the linked list 4 times. uint64_t passstep = 1; // counter to compare to passes diff --git a/d_linkedlist.c b/d_linkedlist.c index 9246dce..05f041e 100644 --- a/d_linkedlist.c +++ b/d_linkedlist.c @@ -14,7 +14,7 @@ struct waster { struct waster *next; }; -struct waster *newnode () { +struct waster *newnode (void) { struct waster *new = malloc(sizeof(struct waster)); return new; @@ -59,7 +59,7 @@ void freellist(struct waster *wr1) { } } -int main () { +int main (void) { struct waster *wr1 = llist(20); struct waster *p; diff --git a/s_linkedlist.c b/s_linkedlist.c index b2f79ad..f9aff1d 100644 --- a/s_linkedlist.c +++ b/s_linkedlist.c @@ -13,7 +13,7 @@ struct waster { struct waster *next; }; -struct waster *newnode () { +struct waster *newnode (void) { struct waster *new = malloc(sizeof(struct waster)); return new; @@ -49,7 +49,7 @@ void freellist(struct waster *wr1) { } } -int main () { +int main (void) { struct waster *wr1 = llist(20); struct waster *p; -- cgit v1.2.3