C++查看变量类型

转自:https://blog.csdn.net/Koyurion/article/details/86315532

1.用法

#include<typeinfo> //需要包含头文件
typeid(data).name()

//打印值:
bool:                     b
 
char:                     c
signed char:              a
unsigned char:            h
 
(signed) short (int):     s
unsigned short (int):     t
 
(signed) (int):           i
unsigned (int):           j
 
(signed) long (int):      l
unsigned long (int):      m
 
(signed) long long (int): x
unsigned long long (int): y
 
float:                    f
double:                   d
long double:              e

 

posted @ 2022-12-19 17:54  lypbendlf  阅读(120)  评论(0编辑  收藏  举报