From b7002c53057d4ae049237786d26f00a762dbc2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Tue, 16 Mar 2021 13:01:32 +0100 Subject: Updated names in standalone/ to match new lab numbering. --- src/standalone/labx3/use-list.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/standalone/labx3/use-list.c (limited to 'src/standalone/labx3/use-list.c') diff --git a/src/standalone/labx3/use-list.c b/src/standalone/labx3/use-list.c new file mode 100644 index 0000000..065f71a --- /dev/null +++ b/src/standalone/labx3/use-list.c @@ -0,0 +1,42 @@ +#include +#include +#include + +/* Pintos contain an implementation of a doubly linked list. It is + * found in ../../lib/kernel/list.[ch]. + * + * Recommended compilation commands: + * + * This is done once: + * gcc -Wall -Wextra -std=gnu99 -pedantic -g -c ../../lib/kernel/list.c + * + * Then use the precomplied list.o: + * gcc -Wall -Wextra -std=gnu99 -pedantic -g use-list.c list.o + */ +#error Read comments above, then remove this line. + +#include "../../lib/kernel/list.h" + +int main() +{ + int i, j; + int N = 1000; + + /* create a list */ + for (i = 2; i < N; ++i) + { + /* insert the value of the loop variable 'i' in the list */ + } + + for (i = 2; i < N; ++i) + { + for (j = i*2; j < N; j += i) + { + /* remove every with 'j' even divisible number from the list */ + } + } + + /* print all remaining numbers in the list and free any memory + * allocated */ + return 0; +} -- cgit v1.2.1