push
This commit is contained in:
commit
fadb328b05
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putchar.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 22:37:40 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:36 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// ft_putchar('c');
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_print_alphabet.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 22:42:06 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:29 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_print_alphabet(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 97;
|
||||||
|
while (i <= 122)
|
||||||
|
ft_putchar(i++);
|
||||||
|
}
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// ft_print_alphabet();
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strlowcase.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:26:17 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:30:43 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
char *ft_strlowcase(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
{
|
||||||
|
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||||
|
str[i] += 32;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// char str[] = "HelLLo212FFFFFff @#@#";
|
||||||
|
// printf("%s", ft_strlowcase(str));
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strcpy.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:31:17 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:38:22 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
char *ft_strcpy(char *dest, char *src)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (src[i])
|
||||||
|
{
|
||||||
|
dest[i] = src[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
dest[i] = '\0';
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// char src[] = "hello";
|
||||||
|
// char dest[10];
|
||||||
|
|
||||||
|
// ft_strcpy(dest, src);
|
||||||
|
// printf("%s", dest);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_ft.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:38:58 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:40:37 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
void ft_ft(int *nbr)
|
||||||
|
{
|
||||||
|
*nbr = 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// int nb;
|
||||||
|
|
||||||
|
// ft_ft(&nb);
|
||||||
|
// printf("%d\n", nb);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_swap.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:41:12 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:43:40 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
void ft_swap(int *a, int *b)
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
tmp = *b;
|
||||||
|
*b = *a;
|
||||||
|
*a = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// int a = 10;
|
||||||
|
// int b = 20;
|
||||||
|
|
||||||
|
// ft_swap(&a, &b);
|
||||||
|
// printf("a = %d, b = %d\n", a, b);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_foreach.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:44:08 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:48:29 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
void ft_foreach(int *tab, int length, void (*f)(int))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < length)
|
||||||
|
{
|
||||||
|
f(tab[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <unistd.h>
|
||||||
|
|
||||||
|
// void ft_putchar(char c)
|
||||||
|
// {
|
||||||
|
// write(1, &c, 1);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// void ft_putnbr(int nb)
|
||||||
|
// {
|
||||||
|
// if (nb == -2147483648)
|
||||||
|
// {
|
||||||
|
// write(1, "-2147483648", 11);
|
||||||
|
// return ;
|
||||||
|
// }
|
||||||
|
// if (nb < 0)
|
||||||
|
// {
|
||||||
|
// ft_putchar('-');
|
||||||
|
// nb = -nb;
|
||||||
|
// }
|
||||||
|
// if (nb > 9)
|
||||||
|
// ft_putnbr(nb / 10);
|
||||||
|
// ft_putchar(nb % 10 + '0');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// int tab[] = {1,2,3,4};
|
||||||
|
// ft_foreach(tab, 4, &ft_putnbr);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_print_param.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:49:03 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:52:50 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_putstr(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
ft_putchar(str[i++]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int ac, char **av)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 1;
|
||||||
|
(void)ac;
|
||||||
|
while (av[i])
|
||||||
|
{
|
||||||
|
ft_putstr(av[i++]);
|
||||||
|
ft_putchar('\n');
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_main_printf.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:56:29 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:59:22 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
int mul2(int nb){return (nb * 2);}
|
||||||
|
char upper(char c){return (c - 32);}
|
||||||
|
char *add1(char str[]){int i = 0; while(str[i]){if (str[i] != 32){str[i] += 1;} i++;} return str;}
|
||||||
|
char *rm1(char str[]){int i = 0; while(str[i]){if (str[i] != 32){str[i] -= 1;} i++;} return str;}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int nb = '*';
|
||||||
|
char c = 99;
|
||||||
|
char e = 33;
|
||||||
|
char str[] = "Gdkkn vnqkc";
|
||||||
|
char str2[] = "(ftu";
|
||||||
|
char d = 34;
|
||||||
|
int nbr = 43;
|
||||||
|
char str3[] = "Gdkqwe weqss !";
|
||||||
|
char str4[] = "*fweeu";
|
||||||
|
printf("%s %c %c%s %d\n", add1(str), e, c, rm1(str2), nb);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_is_negative.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 22:48:11 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:21 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_is_negative(int n)
|
||||||
|
{
|
||||||
|
if (n < 0)
|
||||||
|
write(1, "N", 1);
|
||||||
|
else
|
||||||
|
write(1, "P", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// ft_is_negative(-1);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_iterative_power.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 22:53:07 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:14 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_iterative_power(int nb, int power)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (power < 0)
|
||||||
|
return (0);
|
||||||
|
if (power == 0 || nb == 0)
|
||||||
|
return (1);
|
||||||
|
res = nb;
|
||||||
|
while (power-- > 1)
|
||||||
|
res *= nb;
|
||||||
|
return (res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// printf("%d\n", ft_iterative_power(5, 5));
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_recursive_power.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 22:59:09 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:08 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_recursive_power(int nb, int power)
|
||||||
|
{
|
||||||
|
if (power < 0)
|
||||||
|
return (0);
|
||||||
|
else if (power == 0 || nb == 0)
|
||||||
|
return (1);
|
||||||
|
if (power != 1)
|
||||||
|
return (nb * ft_recursive_power(nb, power - 1));
|
||||||
|
return (nb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// printf("%d\n", ft_recursive_power(5, 2));
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putnbr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:03:38 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:12:01 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_putnbr(int nb)
|
||||||
|
{
|
||||||
|
if (nb == -2147483648)
|
||||||
|
{
|
||||||
|
write(1, "-2147483648", 11);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (nb < 0)
|
||||||
|
{
|
||||||
|
ft_putchar('-');
|
||||||
|
nb = -nb;
|
||||||
|
}
|
||||||
|
if (nb > 9)
|
||||||
|
ft_putnbr(nb / 10);
|
||||||
|
ft_putchar(nb % 10 + '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// ft_putnbr(21474);
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putstr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:09:29 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:13:21 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_putstr(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
ft_putchar(str[i++]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
ft_putstr("");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strlen.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:13:42 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:15:58 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_strlen(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
i++;
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// printf("%d", ft_strlen("1234567890"));
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_str_is_alpha.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:16:47 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:21:38 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_str_is_alpha(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
{
|
||||||
|
if ((str[i] >= 'a' && str[i] <= 'z')
|
||||||
|
|| (str[i] >= 'A' && str[i] <= 'Z'))
|
||||||
|
i++;
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// printf("%d", ft_str_is_alpha("sd1asd"));
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_str_is_printable.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/02/22 23:22:09 by sgongas #+# #+# */
|
||||||
|
/* Updated: 2026/02/22 23:25:39 by sgongas ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
int ft_str_is_printable(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i])
|
||||||
|
{
|
||||||
|
if (str[i] >= 32 && str[i] <= 126)
|
||||||
|
i++;
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #include <stdio.h>
|
||||||
|
|
||||||
|
// int main(void)
|
||||||
|
// {
|
||||||
|
// printf("%d", ft_str_is_printable("test"));
|
||||||
|
// return (0);
|
||||||
|
// }
|
||||||
|
// "\x01"
|
||||||
Loading…
Reference in New Issue