sync
This commit is contained in:
41
C_09/git/ex02/ft_split.c
Normal file
41
C_09/git/ex02/ft_split.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_split.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/22 18:14:04 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/22 18:30:07 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int ft_strlen(char *str)
|
||||
{
|
||||
char *p_str;
|
||||
|
||||
p_str = str;
|
||||
while (*p_str != '\0')
|
||||
p_str++;
|
||||
return (p_str - str);
|
||||
}
|
||||
|
||||
char **ft_split(char *str, char *charset)
|
||||
{
|
||||
char *p_str;
|
||||
char **strs;
|
||||
int size;
|
||||
int r;
|
||||
|
||||
r = 1;
|
||||
p_str = str;
|
||||
while (p_str != '\0')
|
||||
{
|
||||
p_str++;
|
||||
}
|
||||
strs = (char **) malloc((size) * sizeof(char));
|
||||
return (strs);
|
||||
}
|
||||
Reference in New Issue
Block a user