Adding layer

This commit is contained in:
AnonymusRaccoon
2020-01-04 16:56:28 +01:00
parent af7fbefa57
commit 3bdda0c03d
13 changed files with 37 additions and 16 deletions
+2
View File
@@ -6,6 +6,8 @@
*/
#pragma once
int my_str_islower_or_num(const char *str);
int my_printf(const char *str, ...);
void print_ptr(void *ptr);
+2 -2
View File
@@ -7,7 +7,7 @@
int my_strlen(const char *str);
int my_compute_power_it(int i, int p);
int my_pow(int i, int p);
static int indexof(char c, const char *str)
{
@@ -29,7 +29,7 @@ static int parse(char *str, const char *base, long n, int i)
neg = -1;
i *= -1;
}
power = my_compute_power_it(base_length, i - 1);
power = my_pow(base_length, i - 1);
n += indexof(str[str_length - i], base) * power * neg;
if ((n > 0 && neg < 0) || (n < 0 && neg > 0))
return (0);
+11
View File
@@ -5,6 +5,8 @@
** Duplicate of the string.h (I think)
*/
int is_digit(char c);
int is_lowercase(char c)
{
if (c >= 'a' && c <= 'z')
@@ -20,3 +22,12 @@ int my_str_islower(const char *str)
}
return (1);
}
int my_str_islower_or_num(const char *str)
{
for (int i = 0; str[i] != '\0'; i++) {
if (!is_lowercase(str[i]) && !is_digit(str[i]))
return (0);
}
return (1);
}