char 是单字符类型,长度为一个字节

wchar_t 是宽字符类型,长度为两个字节,主要用在国际 Unicode 编码中

举例:

#include<iostream>

using namespace std;

int main(void)
{
char a = 'A';
wchar_t b = L'B';
wchar_t c = L'龙'; cout << a << " -> " << sizeof(a) << endl; // 宽字符输出用wcout
wcout << b << " -> " << sizeof(b) << endl; // C++中默认为EN_US,中文需转换
wcout.imbue(locale("chs"));
wcout << c << " -> " << sizeof(c) << endl; return ;
}

运行结果:

最新文章

  1. ACM/ICPC 之 三维计算几何+暴力枚举+判重(HDU5839)
  2. 为什么可以说Java语言是准动态语言?
  3. Windows Azure Cloud Service (43) 使用Azure In-Role Cache缓存(2)Dedicated Role
  4. HDU-----(1083)Courses(最大匹配)
  5. iOS 开发中的争议(二)
  6. javascript字符类型操作函数
  7. JMS ActiveMQ案例
  8. Python 基础系列一:初识python(二)基本数据类型
  9. java集合小知识的复习
  10. 测试 ASP.NET Core API Controller
  11. Codeforces Round #486 (Div. 3)-B. Substrings Sort
  12. ABBYY PDF Transformer+系统要求
  13. sql server系统存储过程大全
  14. php api接口安全设计 sign理论
  15. 为什么要用nginx
  16. Java继承相关知识总结
  17. java递归和反向递归
  18. Java 更改日期格式
  19. 【Python】安装Python的mysql模块
  20. 《深入理解Linux内核》阅读笔记 --- Chapter 3 Processes

热门文章

  1. there is no route defined for key Agreement(react native bug记录)
  2. Fortify漏洞之Insecure Randomness(不安全随机数)
  3. springboot整合tkmybatis
  4. 【填坑】Ubuntu安装vsftpd
  5. VIM的配置以及插件管理
  6. Json序列化 总结
  7. 使用FastJSON 对Map/JSON/String 进行互转
  8. HTML&amp;CSS基础-内边框
  9. linux ssh_config和sshd_config配置文件学习
  10. android在主线程下载文件