# HG changeset patch # User Christian Urban # Date 1412632664 -3600 # Node ID 38718062709a53a560eaebbd4e02a8deda3c56a5 # Parent 06cc381928659393ddd5d54352c7379192898050 updated C2 diff -r 06cc38192865 -r 38718062709a handouts/ho03.pdf Binary file handouts/ho03.pdf has changed diff -r 06cc38192865 -r 38718062709a progs/C1.c --- a/progs/C1.c Mon Oct 06 22:48:09 2014 +0100 +++ b/progs/C1.c Mon Oct 06 22:57:44 2014 +0100 @@ -1,17 +1,18 @@ -void foo (char *bar) -{ - float my_float = 10.5; // in hex: \x41\x28\x00\x00 - char buffer[28]; +#include +#include + +void dead () { + printf("I will never be printed!"); +} + - printf("my float value = %f\n", my_float); - strcpy(buffer, bar); - printf("my float value = %f\n", my_float); -} - -int main (int argc, char **argv) -{ - foo("my string is too long !!!!! "); - return 0; +int main(int argc, char **argv) { + + char buffer[8]; + + strcpy(buffer, argv[1]); + + return 1; } diff -r 06cc38192865 -r 38718062709a progs/C2a.c --- a/progs/C2a.c Mon Oct 06 22:48:09 2014 +0100 +++ b/progs/C2a.c Mon Oct 06 22:57:44 2014 +0100 @@ -1,7 +1,9 @@ +int i; +char ch; + void get_line(char *dst) { char buffer[8]; - int i = 0; - char ch; + i = 0; while ((ch = getchar()) != '\n') { buffer[i++] = ch; } diff -r 06cc38192865 -r 38718062709a slides/slides03.pdf Binary file slides/slides03.pdf has changed diff -r 06cc38192865 -r 38718062709a slides/slides03.tex --- a/slides/slides03.tex Mon Oct 06 22:48:09 2014 +0100 +++ b/slides/slides03.tex Mon Oct 06 22:57:44 2014 +0100 @@ -230,6 +230,10 @@ \begin{frame}[c] \frametitle{What the Hell Is Going On?} +\begin{itemize} +\item Let's start with a very simple program: +\end{itemize} + \lstinputlisting[language=C,xleftmargin=4mm]{../progs/example1.c} \end{frame}