Aktualizovat „du5/program.c“
This commit is contained in:
parent
42822617e6
commit
46483a5b2e
@ -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;i<c;i++){
|
||||
if(strcmp(PersonList[i].name,PersonList[i+1].name)!=0||flag==0){
|
||||
if(strcmp(PersonList[i]->name,PersonList[i+1]->name)!=0||flag==0){
|
||||
printf("%d %s\n",PersonList[i].score,PersonList[i].name);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user