使用 typeid 判断其类型:(需要在编译语言选项中选择 RTTI 编译选项),例子:【引用自这里】,详情可以看这里
#include#include using namespace std; int main() { char *p=NULL; char str[]="hello world"; cout< 打印出的类型并不是可以直接读懂的,可以参考下面的类型对照表【参考自这里】解读。
::= v # void ::= w # wchar_t ::= b # bool ::= c # char ::= a # signed char ::= h # unsigned char ::= s # short ::= t # unsigned short ::= i # int ::= j # unsigned int ::= l # long ::= m # unsigned long ::= x # long long, __int64 ::= y # unsigned long long, __int64 ::= n # __int128 ::= o # unsigned __int128 ::= f # float ::= d # double ::= e # long double, __float80 ::= g # __float128 ::= z # ellipsis ::= Dd # IEEE 754r decimal floating point (64 bits) ::= De # IEEE 754r decimal floating point (128 bits) ::= Df # IEEE 754r decimal floating point (32 bits) ::= Dh # IEEE 754r half-precision floating point (16 bits) ::= DF _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits) ::= DB _ # C23 signed _BitInt(N) ::= DB _ # C23 signed _BitInt(N) ::= DU _ # C23 unsigned _BitInt(N) ::= DU _ # C23 unsigned _BitInt(N) ::= Di # char32_t ::= Ds # char16_t ::= Du # char8_t ::= Da # auto ::= Dc # decltype(auto) ::= Dn # std::nullptr_t (i.e., decltype(nullptr)) ::= u [ ] # vendor extended type



