Added last three homeworks
This commit is contained in:
parent
f7b2367bc4
commit
0e3d948c9f
363 changed files with 18214 additions and 0 deletions
20
2025.02.28/4Ex/solve.c
Normal file
20
2025.02.28/4Ex/solve.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "solve.h"
|
||||
|
||||
void t4_solve(char **a, int n, int (*cmp)(const char *, const char *))
|
||||
{
|
||||
char *temp;
|
||||
int i, j;
|
||||
for (i=n; i > 0; --i)
|
||||
{
|
||||
for (j=0; j < i-1; ++j)
|
||||
{
|
||||
if (cmp(a[j], a[j+1]) >= 0)
|
||||
{
|
||||
temp = a[j];
|
||||
a[j] = a[j+1];
|
||||
a[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue