From 94d0033ed89bb5bfb6500051296892fb7cea6c29 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 25 Dec 2023 17:56:34 +0100 Subject: Small cleanup --- 2023/03/3b.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to '2023/03/3b.c') diff --git a/2023/03/3b.c b/2023/03/3b.c index 27b5b7c..9bf4c27 100644 --- a/2023/03/3b.c +++ b/2023/03/3b.c @@ -1,22 +1,16 @@ -#include #include #include #include #define N 1000 - -bool isnum(char c) { return c >= '0' && c <= '9'; } +#define ISNUM(c) (c >= '0' && c <= '9') int grab(char *buf) { - int x; - - if (!isnum(*buf)) - return 0; - - while (isnum(*buf)) buf--; + if (!ISNUM(*buf)) return 0; + while (ISNUM(*buf)) buf--; buf++; - x = atoi(buf); - while (isnum(*buf)) *buf++ = '.'; + int x = atoi(buf); + while (ISNUM(*buf)) *buf++ = '.'; return x; } -- cgit v1.3