From: Mart Lubbers Date: Mon, 2 Mar 2015 08:32:13 +0000 (+0100) Subject: assignment 4-1 epic opfuscated X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ed3ff8d445e8e4b0d727ba1b83e3a15fe857f57b;p=sws1-1415.git assignment 4-1 epic opfuscated --- diff --git a/ass4/assignment4.pdf b/ass4/assignment4.pdf new file mode 100644 index 0000000..e8b1b64 Binary files /dev/null and b/ass4/assignment4.pdf differ diff --git a/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1.c b/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1.c new file mode 100644 index 0000000..b361d09 --- /dev/null +++ b/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1.c @@ -0,0 +1,11 @@ +#include +#include + +int main(void) +{ + size_t block = 0; + char *b, d = 1; + for(size_t i = 1 << 31; i >= 1; i /= 2, free(b)) + d = (b = malloc(block += d * i)) == NULL ? -1 : 1; + printf("One malloc can allocate at most %zu bytes\n", block); +} diff --git a/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1b b/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1b new file mode 100644 index 0000000..ec3a65e --- /dev/null +++ b/ass4/mart/sws1-assignment4-s4109503-s4202015/exercise1b @@ -0,0 +1,3 @@ +This is not always the same since there is not always the same amount of memory +available in the system. This is probably because the os has given memory to +some other program.