Rm weird stuff
This commit is contained in:
parent
a811adb340
commit
a815bb5452
|
@ -1,33 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_strlen.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2023/03/27 00:57:16 by tischmid #+# #+# */
|
|
||||||
/* Updated: 2023/03/27 00:58:43 by tischmid ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
int ft_strlen(char *str)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (*str++)
|
|
||||||
++i;
|
|
||||||
return (i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ////
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
char str[10] = "Hello";
|
|
||||||
|
|
||||||
printf("%d\n", ft_strlen(str));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
*/ ////
|
|
|
@ -1,26 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_putstr.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2023/03/27 18:56:17 by tischmid #+# #+# */
|
|
||||||
/* Updated: 2023/03/27 18:57:25 by tischmid ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
void ft_putstr(char *str)
|
|
||||||
{
|
|
||||||
while (*str)
|
|
||||||
write(1, str++, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ////
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
ft_putstr("HELLO WORLD\n");
|
|
||||||
}
|
|
||||||
*/ ////
|
|
|
@ -1,60 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_putnbr.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2023/03/27 18:57:42 by tischmid #+# #+# */
|
|
||||||
/* Updated: 2023/03/27 19:50:56 by tischmid ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
void ft_putchar(char c)
|
|
||||||
{
|
|
||||||
write(1, &c, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ft_putnbr(int nb)
|
|
||||||
{
|
|
||||||
if (nb > 9)
|
|
||||||
{
|
|
||||||
ft_putnbr(nb / 10);
|
|
||||||
ft_putchar(nb % 10 + '0');
|
|
||||||
}
|
|
||||||
else if (nb == INT_MIN)
|
|
||||||
{
|
|
||||||
ft_putnbr(nb / 10);
|
|
||||||
ft_putnbr(-(nb % 10));
|
|
||||||
}
|
|
||||||
else if (nb < 0)
|
|
||||||
{
|
|
||||||
ft_putchar('-');
|
|
||||||
ft_putnbr(-nb);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ft_putchar(nb % 10 + '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ////
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
ft_putnbr(INT_MIN);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(-12);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(-1);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(0);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(1);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(12);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
ft_putnbr(INT_MAX);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
}
|
|
||||||
*/ ////
|
|
|
@ -1,79 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_atoi.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2023/03/27 19:51:48 by tischmid #+# #+# */
|
|
||||||
/* Updated: 2023/03/28 14:39:34 by tischmid ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
int ft_isspace(char c)
|
|
||||||
{
|
|
||||||
return (c == ' '
|
|
||||||
|| c == '\t'
|
|
||||||
|| c == '\n'
|
|
||||||
|| c == '\r'
|
|
||||||
|| c == '\f'
|
|
||||||
|| c == '\v');
|
|
||||||
}
|
|
||||||
|
|
||||||
int ft_atoi(char *str)
|
|
||||||
{
|
|
||||||
while (ft_isspace(*str))
|
|
||||||
++str;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ////
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("Expected:<> Actual:<%d>\n", ft_atoi(""));
|
|
||||||
printf("Expected:<0> Actual:<%d>\n", ft_atoi("0"));
|
|
||||||
printf("Expected:<1> Actual:<%d>\n", ft_atoi("1"));
|
|
||||||
printf("Expected:<14> Actual:<%d>\n", ft_atoi("14"));
|
|
||||||
printf("Expected:<120> Actual:<%d>\n", ft_atoi("120"));
|
|
||||||
printf("Expected:<-0> Actual:<%d>\n", ft_atoi("-0"));
|
|
||||||
printf("Expected:<-1> Actual:<%d>\n", ft_atoi("-1"));
|
|
||||||
printf("Expected:<-14> Actual:<%d>\n", ft_atoi("-14"));
|
|
||||||
printf("Expected:<-120> Actual:<%d>\n", ft_atoi("-120"));
|
|
||||||
printf("Expected:<2147483647> Actual:<%d>\n", ft_atoi("2147483647"));
|
|
||||||
printf("Expected:<-2147483648> Actual:<%d>\n", ft_atoi("-2147483648"));
|
|
||||||
printf("Expected:<--2147483648> Actual:<%d>\n", ft_atoi("--2147483648"));
|
|
||||||
printf("Expected:<---2147483648> Actual:<%d>\n", ft_atoi("---2147483648"));
|
|
||||||
printf("Expected:<----2147483648> Actual:<%d>\n", ft_atoi("----2147483648"));
|
|
||||||
printf("Expected:<+-+14> Actual:<%d>\n", ft_atoi("+-+14"));
|
|
||||||
printf("Expected:<-+-+14> Actual:<%d>\n", ft_atoi("-+-+14"));
|
|
||||||
printf("Expected:<-+-14> Actual:<%d>\n", ft_atoi("-+-14"));
|
|
||||||
printf("Expected:<+-+-14> Actual:<%d>\n", ft_atoi("+-+-14"));
|
|
||||||
printf("Expected:< -14> Actual:<%d>\n", ft_atoi(" -14"));
|
|
||||||
printf("Expected:< +-+14> Actual:<%d>\n", ft_atoi(" +-+14"));
|
|
||||||
printf("Expected:< -+-+14> Actual:<%d>\n", ft_atoi(" -+-+14"));
|
|
||||||
printf("Expected:< -+-14> Actual:<%d>\n", ft_atoi(" -+-14"));
|
|
||||||
printf("Expected:< +-+-14> Actual:<%d>\n", ft_atoi(" +-+-14"));
|
|
||||||
printf("Expected:< -14> Actual:<%d>\n", ft_atoi(" -14"));
|
|
||||||
printf("Expected:< +-+14> Actual:<%d>\n", ft_atoi(" +-+14"));
|
|
||||||
printf("Expected:< -+-+14> Actual:<%d>\n", ft_atoi(" -+-+14"));
|
|
||||||
printf("Expected:< -+-14> Actual:<%d>\n", ft_atoi(" -+-14"));
|
|
||||||
printf("Expected:< +-+-14> Actual:<%d>\n", ft_atoi(" +-+-14"));
|
|
||||||
printf("Expected:<\t\t-14> Actual:<%d>\n", ft_atoi("\t\t-14"));
|
|
||||||
printf("Expected:<\t\t+-+14> Actual:<%d>\n", ft_atoi("\t\t+-+14"));
|
|
||||||
printf("Expected:<\t\t-+-+14> Actual:<%d>\n", ft_atoi("\t\t-+-+14"));
|
|
||||||
printf("Expected:<\t\t-+-14> Actual:<%d>\n", ft_atoi("\t\t-+-14"));
|
|
||||||
printf("Expected:<\t\t+-+-14> Actual:<%d>\n", ft_atoi("\t\t+-+-14"));
|
|
||||||
printf("Expected:<\n\n-14> Actual:<%d>\n", ft_atoi("\n\n-14"));
|
|
||||||
printf("Expected:<\n\n+-+14> Actual:<%d>\n", ft_atoi("\n\n+-+14"));
|
|
||||||
printf("Expected:<\n\n-+-+14> Actual:<%d>\n", ft_atoi("\n\n-+-+14"));
|
|
||||||
printf("Expected:<\n\n-+-14> Actual:<%d>\n", ft_atoi("\n\n-+-14"));
|
|
||||||
printf("Expected:<\n\n+-+-14> Actual:<%d>\n", ft_atoi("\n\n+-+-14"));
|
|
||||||
printf("Expected:<\n\n-14baba1> Actual:<%d>\n", ft_atoi("\n\n-14baba1"));
|
|
||||||
printf("Expected:<\n\n+-+14baba1> Actual:<%d>\n", ft_atoi("\n\n+-+14baba1"));
|
|
||||||
printf("Expected:<\n\n-+-+14baba1> Actual:<%d>\n", ft_atoi("\n\n-+-+14baba1"));
|
|
||||||
printf("Expected:<\n\n-+-14baba1> Actual:<%d>\n", ft_atoi("\n\n-+-14baba1"));
|
|
||||||
printf("Expected:<\n\n+-+-14baba1> Actual:<%d>\n", ft_atoi("\n\n+-+-14baba1"));
|
|
||||||
}
|
|
||||||
*/ ////
|
|
Loading…
Reference in New Issue