diff --git a/du5/program.c b/du5/program.c index b68f57e..4e08609 100644 --- a/du5/program.c +++ b/du5/program.c @@ -11,8 +11,8 @@ struct person{ 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; - PersonList[size-1]->name = name; + PersonList[size-1].score = score; + PersonList[size-1].name = name; size++; } @@ -28,7 +28,6 @@ int comp(const void *p1, const void *p2){ int main(){ struct person *PersonList=(struct person *)calloc(0,sizeof(struct person)); - int count = 0; char name[30]; int score=0; int c =0;