查看变量类型

Posted chasemeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了查看变量类型相关的知识,希望对你有一定的参考价值。

示例:

 1 /*查看变量类型*/
 2 #include<iostream>
 3 #include<string>
 4 using namespace std;
 5 int main() {
 6     char c;
 7     int intr;
 8     string str;
 9     cout << typeid(c).name() << endl;
10     cout << typeid(intr).name() << endl;
11     cout << typeid(str).name() << endl;
12     system("pause");
13     return 0;
14 }

结果:

技术图片

以上是关于查看变量类型的主要内容,如果未能解决你的问题,请参考以下文章