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 #+# #+# */
2022-10-10 13:33:47 -04:00
/* Updated: 2022/10/10 14:41:19 by cchauvet ### ########.fr */
2022-10-06 20:30:03 -04:00
/* */
/* ************************************************************************** */
2022-10-10 13:33:47 -04:00
#include "printf.h"
2022-10-06 20:30:03 -04:00
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);
}