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); }