From bfac43403dd571b98ddfb1838fed82a4b0b8e7de Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 9 Apr 2020 19:01:22 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu5/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du5/program.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/du5/program.c b/du5/program.c index fc0f44a..b68f57e 100644 --- a/du5/program.c +++ b/du5/program.c @@ -2,6 +2,7 @@ #include #include + struct person{ int score; char name[30]; @@ -9,7 +10,7 @@ struct person{ void addElement(struct person* PersonList,int score,char *name){ static int size = 1; - PersonList = realloc(PersonList,size*sizeof(struct person); + PersonList = realloc(PersonList,size*sizeof(struct person)); PersonList[size-1]->score = score; PersonList[size-1]->name = name; size++; @@ -32,7 +33,7 @@ int main(){ int score=0; int c =0; while(scanf("%d %s",&score,name)!=EOF){ - addElement(&PersonList,score,name); + addElement(PersonList,score,name); c++; } @@ -47,11 +48,11 @@ int main(){ idex=0; } } - + int flag=0; printf("Vysledok\n"); for(int i =0;i