Answers for "how to know the type of variable in cpp"

C++
2

get type of variable in c++

auto a = 10;
cout << typeid(a) << endl;
Posted by: Guest on December-16-2021
3

check variable type c++

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
Posted by: Guest on August-11-2021

Code answers related to "how to know the type of variable in cpp"

Browse Popular Code Answers by Language