ft_tolower

J_JEON·2021년 12월 21일
1

libft

목록 보기
7/44

💻 ft_lower

알파벳 대문자라면 소문자로 바꿔주는 함수

📃 ft_lower 원형

int	ft_tolower(int c)

🔩 parameter

int c -> 알파벳 대문자인지 소문자인지 확인하고 바꿔줄 값

📬 return

int형 반환

  • c가 알파벳 대문자라면 소문자로 바꿔준 뒤 반환
  • c가 알파벳 대문자가 아니라면 그대로 반환

🧨 주의사항

알파벳 소문자와 대문자는 ascii코드 10진수로 32가 차이남.
ex) a == 97, A == 65

⌨ 코드


#include "libft.h"

int	ft_tolower(int c)
{
	if (c >= 65 && c <= 90)
	{
		c += 32;
	}
	return (c);
}
profile
늅늅

2개의 댓글

comment-user-thumbnail
2022년 9월 6일

Hey J_JEON, you need to change the sub headlines from ft_toupper to ft_tolower. I guess you just copied everything from the previous post, i.e. ft_toupper and forgot to change the sub headlines. I just found your blogs and your blogs have been very important resources for my cursus. Thank you.

1개의 답글