diff options
| author | klaar36 <klas.arvidsson@liu.se> | 2017-03-20 17:59:45 +0100 |
|---|---|---|
| committer | klaar36 <klas.arvidsson@liu.se> | 2017-03-20 17:59:45 +0100 |
| commit | f9003d89b17c039ab903f622580e61925e137523 (patch) | |
| tree | b46ab4f9745c96a78685ca29b6a18ed2531205d6 /src/standalone/upg4/use-list.c | |
| parent | d9ae213323d0a036b7f3594de6822413a4c312c6 (diff) | |
| download | pintos-rs-f9003d89b17c039ab903f622580e61925e137523.tar.gz | |
added given files for standalone labs
Diffstat (limited to 'src/standalone/upg4/use-list.c')
| -rw-r--r-- | src/standalone/upg4/use-list.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/standalone/upg4/use-list.c b/src/standalone/upg4/use-list.c new file mode 100644 index 0000000..065f71a --- /dev/null +++ b/src/standalone/upg4/use-list.c @@ -0,0 +1,42 @@ +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +/* 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; +} |
