ft_isalpha

one·2021년 1월 10일
0

✅isalpha

  • 알파벳인지 알려주는 함수.

💾함수 원형

int isalpha(int c)

💻Return value

  • 알파벳이 아닐 경우 0
  • 알파벳일 경우 0 이 아닌 수

💾함수 구현

#include "libft.h"

int		ft_isalpha(int c)
{
    return ((('a' <= c) && ('z' >= c)) || (('A' <= c) && ('Z' >= c)));
}

💾사용 예시

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

int main(void)
{
    printf("%d\n", ft_isalpha('a'));
    printf("%d\n", ft_isalpha('A'));
    printf("%d\n", ft_isalpha('0'));

    return 0;
}

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

0개의 댓글