drop array
This commit is contained in:
@@ -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" */
|
||||
|
||||
Reference in New Issue
Block a user