AfanasevGad7

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/AfanasevGad7
Log | Files | Refs | README

commit 3ddd72fde7a3b8dd9eb8d2e9afa5be4e7ae9a0c1
parent 95e7e09b30a57a7a307192c0cb0661e6773f6578
Author: Plat <plat@stellar-nexus.ru>
Date:   Thu,  6 Nov 2025 20:41:24 +0000

Fixed issues with parser

Diffstat:
Mrb.c | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/rb.c b/rb.c @@ -1,3 +1,4 @@ +#include <ctype.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -111,20 +112,17 @@ main(int argc, char *argv[]) int arr[1000000], ch; char w[64]; - for (int i = 0, wi = 0; (ch = fgetc(file)) != EOF; ) { - if (!isspace(ch)) { + int i = 0, wi = 0; + do { + ch = fgetc(file); + if (!isspace(ch) && ch != EOF) { w[wi++] = ch; } else if (wi > 0) { w[wi] = '\0'; arr[i++] = estrtonum(w, 0, INT_MAX); wi = 0; } - } - - if (wi > 0) { - w[wi] = '\0'; - arr[i++] = estrtonum(w, 0, INT_MAX); - } + } while (ch != EOF); efshut(file, filename); Node *root = NULL;