C 언어: toupper 함수

C언어: 영문 소문자를 대문자로 변환


/// 헤더파일

#include <ctype.h>

/// 함수원형

int toupper(int c)

/// 인자

int c: (char c) 변환하고 싶은 소문자(영문)

/// 반환값

반환값(return value): 대문자 ascii (영문 소문자일 경우)
반환값(return value): 원래 ascii (영문 소문자가 아닐 경우)

/// 참고파일

헤더파일: ctype.h(연결)
헤더파일: ctype.h(연결)

reference
https://man7.org/linux/man-pages/man3/tolower.3.html

/// 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <ctype.h>
 
int main(void) {
    char a;
    
    a = toupper('a');
    printf("%c\n", a);
    
    puts("\n");
    
    for (register int i = 97; i < 123; i++) {
        printf("ascii : %3d=%c | toupper('%c')=%c (%3d ascii)\n", i, i, i, toupper(i), toupper(i));
    }
      
    puts("");
    puts("------ ascii 0 ~ 96 ------\n");
      
    for (register int i = 0; i < 97; i++) {
        printf("ascii : %2d=%c | toupper('%c')=%c (%3d ascii)\n", i, i, i, toupper(i), toupper(i));
    }
      
    puts("");
    puts("------ ascii 123 ~ 255 ------\n");
   
    for (register int i = 123; i < 256; i++) {
        printf("ascii : %3d=%c | toupper('%c')=%c (%3d ascii)\n", i, i, i, toupper(i), toupper(i));
    }    
  
    return 0;
}
cs

* 실행환경: Linux(5.7.6-x86_64-linode136)
* 컴파일러: gcc (Ubuntu 6.5.0-2ubuntu1~14.04.1) 6.5.0 20181026


- 당신을 응원합니다. -

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수