Hi ,
This is a program I have been trying to read some names and points for those names from a file , then array the names based on their points and write them to another text file . I may have done a terrible work , I am sorry If I did.

Code:
#include <stdio.h> 
#include <string.h>
typedef struct kayit {
		char s[40];
	} KAY;
	KAY k[10];
void sirala(int *,int,struct kayit *);

int main() {
FILE *fp;
fp=fopen("d.txt","r");
struct kayit {
		char s[40];
	};
	struct kayit k[10];
	int i=0;
	while(fgets(k[i].s,20,fp)!=NULL)
	 i++;
	int x=i-1;
char *p;
	
	int c[40];
	for(i=0;i<=x;i++) {
		p=strpbrk(k[i].s,"0123456789");
		sscanf(p,"%d",&c[i]);
	 printf("%d\n",c[i]);
		}
	fclose(fp);
sirala(c,x+1,k);
	printf("%s\n%s\n",k[0].s,k[1].s);
	fp=fopen("sonuc.txt","w");
	
	
	for(i=0;i<=x;i++) {
	
		fprintf(fp,"%s",k[i].s); }







	return 0;
}
	
	
	
	
	
	
	
	
	

	void sirala(int *d,int y,struct kayit *i) {
 int say,tur,tut;
		
		for(tur=0;tur<y-1;tur++) {
			for(say=0;say<y;say++) {
				if(d[say]>d[say+1]) {
                             tut=d[say];
						d[say]=d[say+1];
						d[say+1]=tut; 
				KAY gecici =i[say];
				i[say]=i[say+1];
				i[say+1]=gecici;
				}
				}}
		}
Also variable names are turkish , I havent changed them , I hope those dont confuse anyone . Thank you for your help , If I couldnt tell the aim of problem here I will try it again :
For example a text file :

Alex 90
Roberto 70
Elisha 60

The program will make the text like this :

Elisha 60
Roberto 70
Alex 90