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
#include <stdio.h>
#include <stdlib.h>
-int main()
+int main(void)
{
FILE *f = fopen("/dev/urandom", "r");
char c;
c = fgetc(f);
printf("%i %u %x\n", c, c, c);
} while(c != 42);
- if(f != stdin)
- fclose(f);
+ fclose(f);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
-int main()
+int main(void)
{
FILE *f = fopen("/dev/urandom", "r");
uint16_t c;
c = fgetc(f)+fgetc(f)*256;
printf("%04x\n", c);
} while(c != 42);
- if(f != stdin)
- fclose(f);
+ fclose(f);
return 0;
}
--- /dev/null
+int main(void)
+{
+
+}