first commit
This commit is contained in:
5
ended/C04-corr/ex00/ft_strlen.c
Normal file
5
ended/C04-corr/ex00/ft_strlen.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
printf("%d", ft_strlen("ffff"));
|
||||
}
|
4
ended/C04-corr/ex01/ft_putstr.c
Normal file
4
ended/C04-corr/ex01/ft_putstr.c
Normal file
@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
ft_putstr("fff");
|
||||
}
|
36
ended/C04-corr/ex02/ft_putnbr.c
Normal file
36
ended/C04-corr/ex02/ft_putnbr.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/25 13:03:53 by ajoly #+# #+# */
|
||||
/* Updated: 2022/07/25 13:03:55 by ajoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putnbr(int nb)
|
||||
{
|
||||
long nb_long;
|
||||
int nb_temp;
|
||||
int div;
|
||||
|
||||
nb_long = nb;
|
||||
div = 1;
|
||||
if(nb_long < 0)
|
||||
{
|
||||
write(1, "-", 1);
|
||||
nb_long *= -1;
|
||||
}
|
||||
while (nb_long / 10 >= div)
|
||||
div *= 10;
|
||||
while (div >= 1)
|
||||
{
|
||||
nb_temp = (nb_long / div) + 48;
|
||||
write(1, &nb_temp, 1);
|
||||
nb_long = nb_long % div;
|
||||
div = div / 10;
|
||||
}
|
||||
}
|
5
ended/C04-corr/ex03/ft_atoi.c
Normal file
5
ended/C04-corr/ex03/ft_atoi.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("%d\n", ft_atoi(" ---+-++123jkjh54984"));
|
||||
}
|
4
ended/C04-corr/ex04/ft_putnbr_base.c
Normal file
4
ended/C04-corr/ex04/ft_putnbr_base.c
Normal file
@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
ft_putnbr_base(126, "0123456789abcdef");
|
||||
}
|
Reference in New Issue
Block a user