42_ft_printf/ft_ctoa.c

26 lines
1.0 KiB
C
Raw Normal View History

2022-10-06 20:30:03 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ctoa.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 21:42:53 by cchauvet #+# #+# */
/* Updated: 2022/10/07 00:49:07 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
char *ft_ctoa(int c)
{
char *s;
s = malloc(sizeof(char) * 2);
if (s == NULL)
return (NULL);
s[0] = (char) c;
s[1] = 0;
return (s);
}