xxxxxxxxxx
#include<iostream>
using namespace std;
main()
{
auto variable = 45;
cout << typeid(variable).name() << endl;
}
xxxxxxxxxx
if (typeid(variable) == typeid(std::string)) {
std::cout << variable << " is a string" << std::endl;
}
else {
std::cout << variable << " is not a string" << std::endl;
}//you can do this for every type
xxxxxxxxxx
Type Description
bool Stores either value true or false.
char Typically a single octet (one byte). This is an integer type.
int The most natural size of integer for the machine.
float A single-precision floating point value.
double A double-precision floating point value.
void Represents the absence of type.
wchar_t A wide character type.