drop array

This commit is contained in:
vrd
2023-01-02 20:24:17 +02:00
parent 6cbe64f927
commit 2ec892755f
7 changed files with 116 additions and 283 deletions
+1 -40
View File
@@ -1,40 +1 @@
#include"help.h"
#include"tree.h"
unsigned strLen(const char* str)
{
unsigned len = 0;
for (; str[len] != '\0'; ++len)
;
return len;
}
void strCopy(char *to, const char* from)
{
unsigned i = 0;
for (; from[i] != '\0'; ++i)
to[i] = from[i];
to[i] = '\0';
}
bool strComp(const char* first, const char* second)
{
for (unsigned i = 0; first[i] != '\0' || second[i] != '\0'; ++i)
{
if (first[i] != second[i])
return 0;
}
return 1;
}
char* mergeStr(const char* first, const char* second) //Create new string from 2 existing and return it
{
char *result = new char[strLen(first) + strLen(second) + 1];
unsigned j = 0;
for (unsigned i = 0; first[i] != '\0'; ++i, ++j)
result[j] = first[i];
for (unsigned i = 0; second[i] != '\0'; ++i, ++j)
result[j] = second[i];
result[j] = '\0';
return result;
}
/* #include"help.h" */