#include <iostream>using namespace std;int main() {// 1、字符型变量创建方式char ch = 'a';cout << "ch = " << ch << endl;// 2.字符型变量所占的内存大小cout << "ch所在内存空间大小" << sizeof(ch) << endl;// 3.字符型变量常见错误// char ch2 = 'b'; // 创建字符型变量需要单引号// char ch3 = 'abcdef'; // 创建字符型变量时候、单引号内只能有一个字符// 4.字符型对应的ASCII编码 a - 97 A - 65cout << (int)ch << endl;system("pause");return 0;}
