From 46483a5b2e4b85688edf0d22cced6749b479e389 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 9 Apr 2020 19:20:10 +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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/du5/program.c b/du5/program.c index 455c123..efc0f81 100644 --- a/du5/program.c +++ b/du5/program.c @@ -8,7 +8,7 @@ struct person{ char name[30]; }; -void addElement(struct person **PersonList,int score,char *name){ +void addElement(struct person *PersonList,int score,char *name){ static int size = 1; PersonList = realloc(PersonList,size*sizeof(struct person)); PersonList[size-1]->score = score; @@ -27,7 +27,7 @@ int comp(const void *p1, const void *p2){ int main(){ - struct person **PersonList=(struct person **)calloc(0,sizeof(struct person*)); + struct person PersonList=calloc(0,sizeof(struct person*)); char name[30]; int score=0; int c =0; @@ -50,7 +50,7 @@ int main(){ int flag=0; printf("Vysledok\n"); for(int i =0;iname,PersonList[i+1]->name)!=0||flag==0){ printf("%d %s\n",PersonList[i].score,PersonList[i].name); }