Thank you but i have another problem now, i am trying to use that struct in a function that i made to sort the numbers but command-line is crashing...

this is my function :

Code:

void bubsort(struct student x[10]){
int z,y,temp=0;
char temp2[15];
for(z=0; z<10; z++){
for(y=0; y<9; y++){
if(x[y].mid1>x[y+1].mid1){
temp = x[y+1].mid1;
x[y+1].mid1 = x[y].mid1;
x[y].mid1 = temp;
strcpy (temp2,x[y+1].name);
strcpy (x[y+1].name,x[y].name);
strcpy (x[y+1].name,temp2);
strcpy (temp2,x[y+1].surname);
strcpy (x[y+1].surname,x[y].surname);
strcpy (x[y+1].surname,temp2);
//temp2 = x[y+1].name;
//x[y+1].name = x[y].name;
//x[y].name = temp2;
//temp2 = x[y+1].surname;
//x[y+1].surname = x[y].surname;
//x[y].surname = temp2;
} } } }

I tried to use the // parts first but its giving me error that i cant assign an array.

and this is how i call the function:

Code:

printf ("Choose sorting type,for midterm1=1 , midterm2=2, final=3.\n");
scanf ("%d",sort);
if (sort==1)
bubsort(x);
for (int k=0;i<10;i++)
printf("%s %s %d",x[i].name,x[i].surname,x[i].mid1);