Libft(21) - toupper
2021. 6. 26. 20:43ㆍ42seoul/42 Cursus
Libft(21) - toupper
TOUPPER(3) BSD Library Functions Manual TOUPPER(3)
NAME
toupper, toupper_l -- lower case to upper case letter conversion
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <ctype.h>
int
toupper(int c);
#include <ctype.h>
#include <xlocale.h>
int
toupper_l(int c, locale_t loc);
DESCRIPTION
The toupper() function converts a lower-case letter to the corresponding upper-case let-
ter. The argument must be representable as an unsigned char or the value of EOF.
Although the toupper() function uses the current locale, the toupper_l() function may be
passed a locale directly. See xlocale(3) for more information.
RETURN VALUES
If the argument is a lower-case letter, the toupper() function returns the corresponding
upper-case letter if there is one; otherwise, the argument is returned unchanged.
COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type
in locales with large character sets is considered obsolete and may not be supported in
future releases. The towupper() function should be used instead.
SEE ALSO
ctype(3), isupper(3), towupper(3), xlocale(3)
STANDARDS
The toupper() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
BSD July 17, 2005 BSD
- 소문자 -> 대문자
- a : 97, A : 65
- 97 - 65 = 32
- 즉, 소문자에서 대문자를 만들기 위해서는 32만큼을 빼주면 된다.
- 소문자인지 확인한 후에 비트 연산으로 'lowercase & 0b11011111' 작업 수행!
'42seoul > 42 Cursus' 카테고리의 다른 글
Libft(23) - calloc (0) | 2021.06.26 |
---|---|
Libft(22) - tolower (0) | 2021.06.26 |
Libft(20) - isprint (0) | 2021.06.26 |
Libft(19) - isascii (0) | 2021.06.26 |
Libft(18) - isalnum (0) | 2021.06.26 |