C toupper() 소문자를 대문자로 변환 함수
C언어 함수 toupper()는 인수로 받은 문자가 소문자·대문자에 관계 없이 모두 대문자로 변환하여 반환합니다.
- 헤더: ctype.h
- 형태: int toupper( int c)
- 인수: int c - 변환할 문자
- 반환: c가 소문자일 때만 대문자로 변환하여 반환하고, 소문자가 아니라면 그대로 반환
C언어 toupper() 함수 예제
#include <stdio.h>
#include <ctype.h>
int main( void)
{
char str[] = "0xaf1Agh!@#";
int ndx;
for ( ndx= 0; ndx < strlen( str); ndx++)
{
str[ndx] = (char)toupper( str[ndx]);
}
printf( "%s\n", str);
return 0;
}
C언어 toupper() 예제 실행 결과
]$ ./a.out
0XAF1AGH!@#
]$
'컴퓨터 > 프로그래밍' 카테고리의 다른 글
C언어 tolower 함수 대문자를 소문자로 변환 (2) | 2020.03.10 |
---|---|
C언어 isxdigit 함수 문자가 16진수 수치 문자인지 판별 (0) | 2020.03.10 |
C언어 isupper 함수 문자가 대문자인지 판별 (0) | 2020.03.10 |