Aktualizovat „du5/program.c“
This commit is contained in:
		
							parent
							
								
									f583b1cadc
								
							
						
					
					
						commit
						f2a7087010
					
				@ -1,12 +1,13 @@
 | 
			
		||||
#include<stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
struct person{
 | 
			
		||||
	int score;
 | 
			
		||||
	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;
 | 
			
		||||
@ -25,7 +26,7 @@ int comp(const void *p1, const void *p2){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main(){
 | 
			
		||||
	struct person PersonList*=(struct person *)calloc(0,sizeof(struct person));
 | 
			
		||||
	struct person *PersonList=(struct person *)calloc(0,sizeof(struct person));
 | 
			
		||||
	int  count = 0;
 | 
			
		||||
	char name[30];
 | 
			
		||||
	int score=0;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user