ass5a2a
authorMart Lubbers <mart@martlubbers.net>
Mon, 9 Mar 2015 20:06:48 +0000 (21:06 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 9 Mar 2015 20:06:48 +0000 (21:06 +0100)
ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c [new file with mode: 0644]

diff --git a/ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c b/ass5a/mart/sws1-assignment5-s4109503-s4202015/exercise2a.c
new file mode 100644 (file)
index 0000000..1e26ad4
--- /dev/null
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+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;
+}