small fixes in the code, mainly to ensure things work properly.

This commit is contained in:
Quinn
2025-04-09 14:57:14 +02:00
parent 40c48980b4
commit ef1dcf7c39

View File

@@ -1,12 +1,14 @@
#include <errno.h> #include <features.h>
#include <limits.h> #if _POSIX_C_SOURCE >= 199309L
#include <linux/time.h> # include <bits/time.h>
#include <stdarg.h> # include <errno.h>
#include <stdint.h> # include <limits.h>
#include <stdio.h> # include <stdarg.h>
#include <stdlib.h> # include <stdint.h>
#include <stdnoreturn.h> # include <stdio.h>
#include <time.h> # include <stdlib.h>
# include <stdnoreturn.h>
# include <time.h>
noreturn static inline void error(char* fmt, ...) { noreturn static inline void error(char* fmt, ...) {
va_list args; va_list args;
@@ -31,7 +33,7 @@ int main(int argc, char** argv) {
} }
// if we have input; perform coin flips for those times // if we have input; perform coin flips for those times
for (uint32_t i = 1; i < argc; ++i) { for (uint32_t i = 1; i < (unsigned)argc; ++i) {
int n = 0; // contains the random data int n = 0; // contains the random data
uint64_t headsc = 0; // amount of heads uint64_t headsc = 0; // amount of heads
uint64_t tailsc = 0; // amount of tails uint64_t tailsc = 0; // amount of tails
@@ -53,3 +55,6 @@ int main(int argc, char** argv) {
printf("results:\n heads: %lu\n tails: %lu\n", headsc, tailsc); printf("results:\n heads: %lu\n tails: %lu\n", headsc, tailsc);
} }
} }
#else
# error "platform unsupported"
#endif