Untitled

ft_putchar.c

/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_putchar.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: sungjpar <[email protected].>       +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2022/02/02 17:26:02 by sungjpar          #+#    #+#             */
/*   Updated: 2022/02/02 17:26:07 by sungjpar         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <unistd.h>

void	ft_putchar(char c);

void	ft_putchar(char c)
{
	write(1, &c, 1);
}

testcase

#include <unistd.h>

void	ft_putchar(char c);

int	main(void)
{
	int		i;
	char	c;
	char	nl;

	i = -128;
	nl = '\\n';
	while (i < 128)
	{
		c = (char) i;
		write(1, &c, 1);
		write(1, &nl, 1);
		++i;
	}
	return (0);
}
// char의 범위가 -128~127이기 때문에 궁금해서 한번 넣어봄.
// 출력 불가능한 문자에 대해서 어떻게 처리해야하는가?

write