728x90
반응형
char
- 문자를 표현 하는 타입
- 내부적으로 정수형
- 1 byte - 255가 최대
ascii
- American Standard Code for Information Interchange
- 7비트로 표현 가능한 문자표
- 제어 문자표와 출력 가능한 문자표로 구성
자세한 설명 : https://ko.wikipedia.org/wiki/ASCII
Escape Sequence
- 문자 또는 문자열에 리터럴로 표현할 수 없는 것들을 정의
더보기
# include <iostream>
# include <limits>
# include <stdint.h>
# include <numeric>
using namespace std;
int main(){
// char ch = "a"; // 길이가 1인 문자열
// char ch = 'a'; // 문자
// cout << "Hello World!" << endl; // 문자열 " "문자들이 연속적으로 있는 것이 문자열 공백 또한 문자.
// cout << 'A' << endl; // 문자는 ' ' 안에 단 하나의 문자만 가능하다.
unsigned char ch1 = 97;
cout << "ch1 char형 : " << ch1 << endl;
cout << "ch1 정수형 : " << (int)ch1 <<endl;
// unsigned 최대 255
// signed - -128~127
// cout << numeric_limits<uint8_t> :: max() << endl; // uint8_t 은 unsig
cout << "char형의 sizeof : "<<sizeof(ch1) << endl; // 1byte
// Escape Sequence
cout << "\a"; // 소리 출력
cout << "\n"; // 줄바꿈
cout << "줄바꿈";
}
728x90
반응형
최근댓글