#include <iostream>
using namespace std;
int main()
{
cout << "this is a demo." << endl;
// 布尔型
cout << "bool" << endl;
bool _bool;
cout << _bool << endl;
// signed bool _signed_bool;
// unsigned bool _unsigned_bool;
// short bool _short_bool;
// long bool _long_bool;
cout << sizeof(_bool) << endl; // 占 1 字节
// 字符型
cout << "char" << endl;
char _char;
signed char _signed_char;
unsigned char _unsigned_char;
// short char _short_char;
// long char _long_char;
cout << sizeof(_char) << endl; // 占 1 字节
cout << sizeof(_signed_char) << endl; // 占 1 字节
cout << sizeof(_unsigned_char) << endl; // 占 1 字节
// cout << sizeof(_short_char) << endl; //
// cout << sizeof(_long_char) << endl; //
// 宽字符型
cout << "wchar_t" << endl;
wchar_t _wchar_t;
signed wchar_t _signed_wchar_t;
C++ 基本数据类型的宽度
最新推荐文章于 2024-05-15 19:19:30 发布