int sort int mas int str int stolb int temp kol stroka flag printf Ent

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int sort(int *mas,int str,int stolb)
{
int i,j,temp=0,kol=0,stroka,flag=1;
printf("Enter, how many strings you want to sort.\n");
scanf("%d",&kol);
while(kol>0)
{
printf("Enter number of string which you want to sort\n");
scanf("%d",&stroka);
for(i=stroka;flag==1;){
flag=0;
for(j=0;j<stolb-1;j++){
if(*(mas+i*stolb+j)>*(mas+i*stolb+(j+1))){
temp=*(mas+i*stolb+j);
*(mas+i*stolb+j)=*(mas+i*stolb+(j+1));
*(mas+i*stolb+(j+1))=temp;
flag=1;
}
}
}
flag=1;
kol--;
}
}