From 8b288fa260daddf391ad0695dcc86459fca8cfa9 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 16 Apr 2020 07:48:26 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu6/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du6/program.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/du6/program.c b/du6/program.c index 6157f4a..25b8cd8 100644 --- a/du6/program.c +++ b/du6/program.c @@ -31,11 +31,12 @@ int main() //memset(pole_smernikov,0,SIZE*sizeof(char*)); int k = 0; char* line = malloc(wSIZE * sizeof(char)); - memset(line,0,SIZE); + //memset(line,0,SIZE); //char* r; //int q = 0; - int pocet_znakov = 0; - while (fgets(line,SIZE,stdin)) { + size_t pocet_znakov = 0; + while (fgets(line,wSIZE,stdin)) { + k = 0; pocet_znakov = strlen(line); char* all = malloc(pocet_znakov); memcpy(all, line, pocet_znakov); @@ -50,6 +51,7 @@ int main() pm++; } } + free(line); k = 0; int i = 0; i = 0;