Added last three homeworks
This commit is contained in:
parent
f7b2367bc4
commit
0e3d948c9f
363 changed files with 18214 additions and 0 deletions
18
2025.02.28/Example/compare.c
Normal file
18
2025.02.28/Example/compare.c
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "compare.h"
|
||||
|
||||
int up_strcmp(const char *a, const char *b)
|
||||
{ return strcmp(a, b); }
|
||||
|
||||
int down_strcmp(const char *a, const char *b)
|
||||
{ return strcmp(b, a); }
|
||||
|
||||
int up_len(const char *a, const char *b)
|
||||
{
|
||||
ssize_t diff = (ssize_t)strlen(a) - (ssize_t)strlen(b);
|
||||
if (diff < 0) return -1;
|
||||
if (diff > 0) return 1;
|
||||
return up_strcmp(a, b);
|
||||
}
|
||||
|
||||
int down_len(const char *a, const char *b)
|
||||
{ return up_len(b, a); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue