Language & API/C_기초

tolower(_In_ int _C) 사용법

강한퓨전 2017. 6. 8. 15:20

선언 

<cctype> or <ctype.h>


정의

_Check_return_ _CRT_JIT_INTRINSIC _CRTIMP int __cdecl tolower(_In_ int _C);


설명

char 형 대문자를 -> 소문자로 변환 시켜 줍니다. 

반환값이 Int 입니다. 


파라미터 

_In_ int _C : 아스키코드값(int) or ' ' char 문자 


반환값

int 형 아스키 코드값


예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <cctype>
#include <string.h>
#include <iostream>
//#include <windows.h>
 
using namespace std;
 
int main(_In_ int _Argc, _In_reads_(_Argc) _Pre_z_ char ** _Argv, _In_z_ char ** _Env)
{
    char str[] = "HELLO WORLD";
 
    for (int i = 0; i < strlen(str); i++)
    {
        cout << static_cast<char>(tolower(str[i]));
        //printf("%c", tolower(str[i]));
    }
    cout << endl;
    system("pause");
    return 0;
}
 
cs


결과 

소문자 hello world



틀린 곳이 있거나 더 좋은 의견이 있으시면 댓글 부탁드립니다.