查看变量类型

示例:

 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 }

结果:

posted @ 2020-05-21 18:32  小贼的自由  阅读(328)  评论(0编辑  收藏  举报