ft_toupper

one·2021년 1월 11일
0

✅toupper

  • 알파벳 소문자를 대문자로 변환해주는 함수

💾함수 원형

int toupper(int c);

💾함수 구현

#include "libft.h"

int		ft_toupper(int c)
{
	if ('a' <= c && c <= 'z')
		return (c - 32);
	return (c);
}

💾사용 예시

#include <stdio.h>
//#include <ctype.h>

int main(void)
{
	char ch1 = 'a';
	char ch2 = 'B';

	printf("%c\n", ft_toupper(ch1));
	printf("%c\n", ft_toupper(ch2));
	return 0;
}

profile
늘 호기심을 갖고, 새로운 것에 도전할 것.

0개의 댓글