update ass1-ex1
authorMart Lubbers <mart@martlubbers.net>
Sun, 8 Feb 2015 17:33:11 +0000 (18:33 +0100)
committerMart Lubbers <mart@martlubbers.net>
Sun, 8 Feb 2015 17:33:11 +0000 (18:33 +0100)
ass2/mart/sws1-s4109503-s4202015/Makefile
ass2/mart/sws1-s4109503-s4202015/exercise1b.c
ass2/mart/sws1-s4109503-s4202015/exercise1d.c
ass2/mart/sws1-s4109503-s4202015/exercise2.c [new file with mode: 0644]

index cacd2e7..1b465c7 100644 (file)
@@ -1,7 +1,9 @@
 CC=gcc
 CFLAGS=-std=c99 -Wall -Wextra
 
-all: exercise1b.c exercise1d.c
+all: exercise1
+
+exercise1: exercise1b.c exercise1d.c
        $(CC) $(CFLAGS) exercise1b.c -o exercise1b
        $(CC) $(CFLAGS) exercise1d.c -o exercise1d
 
index 9cbaa94..1f8a43e 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-int main()
+int main(void)
 {
        FILE *f = fopen("/dev/urandom", "r");
        char c;
@@ -9,7 +9,6 @@ int main()
                c = fgetc(f);
                printf("%i %u %x\n", c, c, c);
        } while(c != 42);
-       if(f != stdin)
-               fclose(f);
+       fclose(f);
        return 0;
 }
index 4b6e9c7..07dfa41 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-int main()
+int main(void)
 {
        FILE *f = fopen("/dev/urandom", "r");
        uint16_t c;
@@ -10,7 +10,6 @@ int main()
                c = fgetc(f)+fgetc(f)*256;
                printf("%04x\n", c);
        } while(c != 42);
-       if(f != stdin)
-               fclose(f);
+       fclose(f);
        return 0;
 }
diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise2.c b/ass2/mart/sws1-s4109503-s4202015/exercise2.c
new file mode 100644 (file)
index 0000000..6ea6252
--- /dev/null
@@ -0,0 +1,4 @@
+int main(void)
+{
+
+}