From 87375cad1d94141aad59ef0cdd919615467bb528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Korpesio?= Date: Thu, 25 Nov 2021 16:20:34 +0100 Subject: [PATCH] prvy --- cv8/program.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index 20fd77a..01dd87f 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -1,9 +1,9 @@ #include #include #include -#define SIZE 50 +#define LINESIZE 50 struct tree{ - char question[SIZE]; + char question[LINESIZE]; struct tree* left; struct tree* right; }; @@ -19,8 +19,8 @@ int main(){ struct tree* root = NULL; root = read_tree(); - char resp[SIZE]; - memset(resp,0,SIZE); + char resp[LINESIZE]; + memset(resp,0,LINESIZE); get_input(resp); if(strlen(resp)>1){ printf("Expert z bufetu to vie.\n"); @@ -45,8 +45,8 @@ int main(){ struct tree* read_tree(){ - char buffer[SIZE]; - memset(buffer,0,SIZE); + char buffer[LINESIZE]; + memset(buffer,0,LINESIZE); int flag = get_input(buffer); if(flag==-1){ @@ -56,7 +56,7 @@ struct tree* read_tree(){ } struct tree* node = calloc(1,sizeof(struct tree)); - memcpy(node->question,buffer,SIZE); + memcpy(node->question,buffer,LINESIZE); if(node->question[0]!='*'){ node->left = read_tree(); node->right = read_tree(); @@ -66,7 +66,7 @@ struct tree* read_tree(){ int get_input(char *string){ - char* r = fgets(string,SIZE,stdin); + char* r = fgets(string,LINESIZE,stdin); if(r==NULL){ return -1; } @@ -83,7 +83,7 @@ void system_execute(struct tree* root){ if(root->question[0]=='*'){ return; } - char *resp = calloc(SIZE,sizeof(char)); + char *resp = calloc(LINESIZE,sizeof(char)); int flag = get_input(resp); if(flag==-1){