typeid Operator – Type Casting
How is typeid operator used in C++?
is a type casting method which is used to check the type of an expression. In C++, the typeid keyword is used to determine the class of an object at runtime
cout << "The type of a is: " << typeid(a).name() << endl;
cout << "The type of c is: " << typeid(c).name() << endl;
The type of a is: int
The type of c is: char *
In the above example the “typeid” is used to find the data type.