From: Mart Lubbers Date: Mon, 9 Mar 2015 20:06:48 +0000 (+0100) Subject: ass5a2a X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=72788bcdcd3cebcaf3b53ae60a045ef7844a60d1;p=sws1-1415.git ass5a2a --- diff --git a/ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c b/ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c new file mode 100644 index 0000000..1e26ad4 --- /dev/null +++ b/ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c @@ -0,0 +1,24 @@ +#include + +void function_b(void) +{ + char buffer[4]; + char *p = buffer; + while(*(int *)++p != (int)0xa0b1c2d3); + while(p > buffer) + *p-- = 0; + fprintf(stdout, "Executing function_b\n"); +} +void function_a(void) +{ + int beacon = 0xa0b1c2d3; + fprintf(stdout, "Executing function_a\n"); + function_b(); + fprintf(stdout, "Executed function_b\n"); +} + +int main(void) { + function_a(); + fprintf(stdout, "Finished!\n"); + return 0; +}