Answers for "find variable type in c++"

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 "find variable type in c++"

Browse Popular Code Answers by Language