updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 07 Oct 2014 00:15:41 +0100
changeset 218 bc1f7c82e1a8
parent 217 8ddf4fe6bf31
child 219 c2ac0cb1d00b
updated
handouts/ho03.pdf
handouts/ho03.tex
progs/C1.c
Binary file handouts/ho03.pdf has changed
--- a/handouts/ho03.tex	Tue Oct 07 00:12:29 2014 +0100
+++ b/handouts/ho03.tex	Tue Oct 07 00:15:41 2014 +0100
@@ -154,7 +154,8 @@
 \item \texttt{(l)ist n} -- listing the source file from line 
 \texttt{n}
 \item \texttt{disassemble fun-name}
-\item \texttt{run} -- starts the program
+\item \texttt{run args} -- starts the program, potential 
+arguments can be given
 \item \texttt{(b)reak line-number} -- set break point
 \item \texttt{(c)ontinue} -- continue execution until next 
 breakpoint in a line number
--- a/progs/C1.c	Tue Oct 07 00:12:29 2014 +0100
+++ b/progs/C1.c	Tue Oct 07 00:15:41 2014 +0100
@@ -1,17 +1,20 @@
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 void dead () {
   printf("I will never be printed!\n");
   exit(1);
 }
 
+void foo(char *bar) {
+  char buffer[8];
+  strcpy(buffer, bar);
+}
 
 int main(int argc, char **argv) {
 
-  char buffer[8];
-  dead();
-  strcpy(buffer, argv[1]);
+  foo(argv[1]);
 
   return 1;
 }