From 4607afed9abe82affda373b57463fd08aad5074c Mon Sep 17 00:00:00 2001 From: Quinn Date: Sun, 6 Apr 2025 17:32:26 +0200 Subject: [PATCH] use 64 bit integers for count, rather than 32 bit. Was facing issues with integer wrapping --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 01c32aa..e9a4dea 100644 --- a/src/main.c +++ b/src/main.c @@ -33,8 +33,8 @@ int main(int argc, char** argv) { // if we have input; perform coin flips for those times for (uint32_t i = 1; i < argc; ++i) { int n = 0; // contains the random data - uint32_t headsc = 0; // amount of heads - uint32_t tailsc = 0; // amount of tails + uint64_t headsc = 0; // amount of heads + uint64_t tailsc = 0; // amount of tails // get the integer from the string, return 1 if an error occurred errno = 0; @@ -50,6 +50,6 @@ int main(int argc, char** argv) { } // print the results of this cycle - printf("results:\n heads: %u\n tails: %u\n", headsc, tailsc); + printf("results:\n heads: %lu\n tails: %lu\n", headsc, tailsc); } }