aoc

Advent of Code Solutions
git clone git://git.alexkarle.com.com/aoc
Log | Files | Refs | README | LICENSE

commit 7855d37e65d51d3449ea02d86ded49be66ff5d6a (patch)
parent b408eca5b620b218b1c51bbbad14a099edad3458
Author: Alex Karle <alex@alexkarle.com>
Date:   Thu,  2 Dec 2021 09:53:38 -0500

day1: Replace fscanf(stdin) with scanf

Diffstat:
M1/c/a.c | 2+-
M1/c/b.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/1/c/a.c b/1/c/a.c @@ -5,7 +5,7 @@ int main(void) { int count = 0; int curr; int prev = 0; - while(fscanf(stdin, "%d\n", &curr) != EOF) { + while(scanf("%d\n", &curr) != EOF) { if (prev && curr > prev) { count++; } diff --git a/1/c/b.c b/1/c/b.c @@ -11,7 +11,7 @@ int main(void) { int curr; int prev = 0; int i = 0; - while(fscanf(stdin, "%d\n", &curr) != EOF) { + while(scanf("%d\n", &curr) != EOF) { mem[i++ % 3] = curr; if (i > 3) { if (prev && sum() > prev) {