This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include "libft.h" | |
char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) | |
{ | |
unsigned long i; | |
unsigned long l; | |
char *str; | |
l = ft_strlen(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
void *ft_memalloc(size_t size) | |
{ | |
char *tab; | |
size_t i; | |
tab = (char *)malloc(sizeof(char) * (size + 1)); | |
if (tab == NULL) | |
return (tab); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int skip_spaces(const char *s, int i) | |
{ | |
while (s[i] == ' ' || (9 <= s[i] && s[i] <= 13) || s[i] == '\n') | |
++i; | |
return (i); | |
} | |
int ft_atoi(const char *str) | |
{ | |
int i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ft_strcmp(const char *s1, const char *s2) | |
{ | |
int i; | |
i = 0; | |
while (s1[i] || s2[i]) | |
{ | |
if (s1[i] != s2[i]) | |
return ((unsigned char)s1[i] - (unsigned char)s2[i]); | |
++i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
char *ft_strnstr(const char *haystack, const char *needle, size_t len) | |
{ | |
size_t i; | |
size_t j; | |
if (needle[0] == '\0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ft_list.h" | |
void ft_list_clear(t_list **begin_list) | |
{ | |
t_list *tmp; | |
if (&*begin_list == 0) | |
return ; | |
while (*begin_list->next) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ft_list.h" | |
t_list *ft_list_last(t_list *begin_list) | |
{ | |
if (begin_list == 0) | |
return begin_list; | |
while (begin_list->next) | |
begin_list = begin_list->next; | |
return (begin_list); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
void ft_putchar(char c) | |
{ | |
write(1, &c, 1); | |
} | |
int length(char *str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
void ft_putchar(c) | |
{ | |
write(1, &c, 1); | |
} | |
void print_array(char *arr) | |
{ | |
int x; | |
int y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int length(char *str) | |
{ | |
int i; | |
i = 0; | |
while (str[i]) | |
++i; | |
return (i); |