以下基于c++14版本
整型
short i1 = 1;
int i2 = 0;
long i3 = 0;
unsigned short i4 = 1;
unsigned int i5 = 1;
unsigned long i6 = 1;
浮点型
float f1 = 0.2;
double f2 = -0.2;
long double f5 = 0.9;
字符型
// utf-8字符
char i = 'a';
char u8_array[] = u8"标准库";
std::string u8_str = u8"标准库";
// utf-16字符
char16_t u16_c = u'标';
char16_t u16_array[] = u"标准库";
std::u16string u16_str = u"标准库";
// ucs4字符
char32_t u32_c = U'标';
char32_t u32_array[] = U"标准库";
std::u32string u32_str = U"标准库";
数组
// 定义后赋值
int d[3];
d[0] = 100;
// 定义并初始化
int e[10]={0,1,2,3,4,5,6,7,8,9};
int f[]={5, 6, 7};
int g[10]={0,1,2,3,4};